草庐IT

inside_layout

全部标签

ios - Xcode - IB 可设计 : Failed to render and update auto layout (no suitable image found)

我正在尝试从.xib文件实现自定义UIView,我希望能够在我的Storyboard之一中检查该文件。但是,我收到构建时错误:IBDesignables:FailedtorenderandupdateautolayoutstatusforLoginViewController(BYZ-38-t0r):dlopen(App.app,1):nosuitableimagefound.Didfind:App.app:can'tmapunslidablesegment__TEXTto0x100000000withsize0x268000我正在使用CocoaPods,并且读到这是由于1.5版中的一

ios - swift 4 : Unrecognized selector sent to instance when calling a function inside another class

对于我的应用程序,我在没有Storyboard的情况下工作。出于这个原因,我试图通过将更大的函数存储在另一个类中并在需要时调用它们来使我的ViewController保持整洁。出于某种原因,当我使用#Selector调用我的函数时,出现崩溃,提示“无法识别的选择器已发送至实例”。当我将我的函数存储在与#Selector相同的ViewController中时,它工作得很好。以下代码有效ViewControllerclassViewController:UIViewController{overridefuncviewDidLoad(){super.viewDidLoad()view.ad

Xcode 6.2 中的 Swift playground : println doesn't print anything inside willSet/didSet

在长期使用Objective-C之后,我才刚刚开始学习Swift。根据Apple的推荐,我选择了playgrounds来编码和学习。这是代码:classPolygon{varcolor:UIColor=UIColor.clearColor()varnumberOfSides:Int=0{willSet(newNumber){println("willSetisbeingcalled")}didSet(newNumber){println("didSetisbeingcalled")//justtomakesuredidSetiscallednumberOfSides=12345678}

ios - ContainerView Inside ScrollView 不要在 Swift 3 中滚动

我在GitHub上有示例项目,您可以在->上看到https://github.com/LetSwiftDev/ContainerViewInsideScroll/tree/master我有两个,ViewController,一个是普通的ViewController,名为oneViewController第二个是twoViewController里面有UIScrollView当我点击OPENTWO按钮将转到ContainerView内的twoViewController但是;MytwoViewControllerhavedifferentheightsizelike1500andinsi

ios - 由于未捕获的异常 'NSInvalidArgumentException' 而终止应用程序,原因 : Unknown layout attribute'

我正在尝试以编程方式向UIView中的按钮添加约束:letconstraint=NSLayoutConstraint(item:arrowButton,attribute:NSLayoutAttribute.LeadingMargin,relatedBy:NSLayoutRelation.Equal,toItem:self,attribute:NSLayoutAttribute.NotAnAttribute,multiplier:1,constant:10)arrowButton.addConstraint(constraint)我希望按钮的前边距距离View的左边距为10。此代码在V

ios - Xcode 7 中的 UITest : How to test keyboard layout (keyboardType)

我目前正在Xcode中探索新的UITest库,我想测试在UITextView中单击时弹出的键盘是否具有正确的类型(在本例中它应该是.PhonePad).我认为这对于默认的XCUIElement和XCUIElementAttributes是不可行的(关于它们的实际含义,我仍然有点模糊),我不我真的不明白我应该如何扩展以及扩展什么才能对此进行测试。任何帮助将不胜感激!:) 最佳答案 下面是我用来测试电话号码和密码验证检查的代码。letapp=XCUIApplication()lettablesQuery=app.tablestables

swift - #include 来自模块化项目头文件的系统头文件给出 "Include of non-modular header inside framework module..."错误

我正在尝试将libarchive嵌入到我正在构建的基于Swift的框架中。我创建了一个模块映射以私下包含archive.h(在模块libarchive中接近尾声)frameworkmoduleX{requiresobjc,blocks,objc_arcumbrellaheader"X.h"privateheader"XPrivate.h"privateheader"x.h"useDarwin.Cmodulelibarchive{privateheader"archive.h"export*}}在archive.h中,以下行导致错误:#include我不明白为什么这个包含没有被映射到我的

swift - 嵌套堆栈 View : Child Stack View is not inside its parent stack view when attaching it programmatically

我正在尝试实现嵌套堆栈View,其中一个堆栈View位于另一个堆栈View内。我的代码基于here.我当前的代码在下面。@IBOutletweakvarverticalStackView:UIStackView!letblueImageView=UIImageView()blueImageView.backgroundColor=UIColor.blueColor()blueImageView.image=UIImage(named:"justsomeimage")blueImageView.snp_makeConstraints{(make)inmake.height.width.e

ios - SwiftyJson : Looping an array inside an array

我试图在一个数组中遍历一个数组。第一个循环很简单,但我无法循环遍历其中的第二个数组。欢迎提出任何建议!{"feeds":[{"id":4,"username":"andregomes","feeds":[{"message":"Iamuser4","like_count":0,"comment_count":0}]},{"id":5,"username":"renatosanchez","feeds":[{"message":"Iamuser5","like_count":0,"comment_count":0},{"message":"Iamuser5-2","like_count"

ios - Xcode 9.1 警告 "Language directional layout margins before iOS 11.0"

我注意到Xcode警告说:"LanguagedirectionallayoutmarginsbeforeiOS11.0"即使这个问题在Appledeveloperforumthead.中也没有得到解答我使用了Storyboard和警告不会导致任何特定View。是什么原因或有什么解决办法? 最佳答案 我能够找出警告的原因。在Storyboard->SizeInspector中,将LayoutMargin设置为Default。之前是LanguageDirectional。根据文档,对于ViewController的RootView,UI