草庐IT

iBoutlet

全部标签

ios - IBOutlet 为零,但在 Storyboard 中已连接(Swift 2)

我试图在UITableView的单元格中显示一些内容。该程序确实到达了cellForRowAtIndexPath:overridefunctableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell{letcell:EventTableViewCell=self.tableView.dequeueReusableCellWithIdentifier("eventCell")as!EventTableViewCellletdate=self.eventArray[i

ios - IOS改名变量UILabel、IBOutlet报错

起初,当我创建UILabel时,我使用地址作为变量。它工作正常。但是当我将变量“地址”更改为“dropOffAddress”时。当我运行模拟器Iphone时出现错误。实际上它发生在所有UILabel上,它不能改变变量的名称。我是IOS的新手。如何更改变量名?我也不能删除变量,会发生错误。如何解决?FirstwhenicreatetheUILabeliputnameoflabelis'address'thenirunitok.afterthatineedtochangethenameofUILabelto'dropOffAddress'.Thenwhenirun,ithaveerror.

ios - 使用 iboutlet tableview Swift 子类化

我在Storyboard中有一个ViewController,其中的tableview是这样的:它的类是这样的(我链接了名为“tabella”的iboutlettableview):classRisultatiRicerca:UIViewController,UITableViewDataSource,UITableViewDelegate{varcodeSearch=0@IBOutletpublicvartabella:UITableView!overridefuncviewDidLoad(){super.viewDidLoad()self.tabella.estimatedRowH

iphone - 当我链接 IBoutlets/IBActions 时,IB 在幕后做什么?

我是macdev、xcode和IB等的新手。我了解如何在IB中构建简单的应用程序和基本的拖放操作,但我不知道IB对这些对象做了什么以及在哪里。第二个问题是不用IB怎么写MVC? 最佳答案 当您使用IBOutlet或IBAction连接IB中的两个对象时,它会在XIB(XML)中创建一些特殊标签。当bundle(update:抱歉,它不是bundle,而是UINib)读取NIB(编译后的XIB)时,它会查找它们所引用的标签和对象.之后:对于outlet,它使用KVC(Key-ValueCoding)来设置接收对象的相应属性。对于操作,

ios - 如何从另一个类访问 UIViewController 上的 IBoutlet?

我通过StoryBoard将UIButton放在UIVIewController上。在xxxVIewController.h中@interfacexxxViewController:UIViewController{IBOutletUIButton*But;}@property(retain,nonatomic)IBOutletUIButton*But;我想从另一个类访问“*But”以更改UIButton的设置图像。我想如果我能拿到UIViewController的实例就解决了.....有没有人给我提示谢谢He-Was,JasperBlues我添加了评论。一个是不包含导航Control

iphone - 测试 IBOutlets 自动连接或在未连接的 socket 上构建失败

有没有人想出一种方法来自动单元测试UIViewController子类上定义为IBOutlets的所有属性在加载View后连接(通过调用loadView)?我的理解是IBOutlet是经过预处理的,因此您无法在运行时确定哪些属性是IBOutlet。或者,如果您定义了未连接的IBOutlets,是否还有另一种方法可以强制构建失败?可能是LLVM编译器警告选项? 最佳答案 您可以使用断言,它会让您快速失败(引起您的注意)。-(void)viewDidLoad{[superviewDidLoad];NSAssert(self.myLabe

ios - 在代码中将 UIButton 连接到 IBOutlet 和 IBAction

我有这个是viewDidLoad://SetupregisterbuttonUIButton*registerButton=[UIButtonbuttonWithType:UIButtonTypeSystem];[registerButtonsetTitle:@"Register"forState:UIControlStateNormal];registerButton.frame=CGRectMake(0.0,0.0,self.screenWidth/2.0,100.0);还有这个:-(IBAction)buttonPressed:(UIButton*)sender{}我的.h文件中

ios - nib 中的 UIView 未连接到 IBOutlets

我以这种方式在屏幕上添加一个UIView:ViewController2*detailViewController=[[ViewController2alloc]initWithNibName:@"MJDetailViewController"bundle:nil];[selfpresentPopupViewController:detailViewControlleranimationType:MJPopupViewAnimationFade];由于MJDetailViewController是一个nib并包含一个UIView,我创建了一个自定义的UIView类,并将其选为检查器中V

ios - 两个 Storyboard上的两个 viewControllers 的 IBOutlet ......这可能吗

我有一个应用程序有两个目标,分别用于iPhone和iPad。这个项目没有使用尺寸等级。在iPhone版本上,我有一个Storyboard,其中包含一个名为“termsAndConditions”的viewController。这个viewController有类文件termsAndConditions.h和.m。在termsAndConditions.m中,我有一个outlet链接到viewController上的textView。然后我有iPad的第二个目标。我有一个名为“termsAndConditions”的相同viewController。我的想法是将iPhone版本中的相同类

ios - 带有可选 IBOutlet 的属性多态性

我的iOS项目中有一个多态的UITableViewCells链(针对问题进行了简化):====================|BaseCellWithButton|====================^||========================|BaseCellWithTwoButtons|========================BaseCellWithButton有1个属性:@property(nonatomic,strong)UIButton*button;BaseCellWithTwoButtons非常复杂,我想创建一个Nib。我知道IBOutlet属性通