【发布时间】:2013-07-21 17:54:27
【问题描述】:
我创建了一个 UisegmentControl 的子类并添加到我的项目中。
#import <UIKit/UIKit.h>
@interface MMcustomsegment : UISegmentedControl
@end
在情节提要上,我在身份检查器上选择了正确的自定义类。 但是当我运行它时,我有段控件的标准布局......
如果我以这种方式以编程方式添加我的自定义细分
MMcustomsegment *mySegmentedControl = [[MMcustomsegment alloc]
initWithItems:tipoord];
mySegmentedControl.frame = CGRectMake(20, self.view.frame.size.height - 160, 280, 29);
mySegmentedControl.selectedSegmentIndex = 0;
[mySegmentedControl addTarget:self action:@selector(valueChanged:) forControlEvents: UIControlEventValueChanged];
[self.view addSubview:mySegmentedControl];
有效!!
我的自定义 uistepper 使用相同的员工
我真的不知道如何解决它。 谢谢
抱歉我的英语不好
【问题讨论】:
-
您是否已将您在 Storyboard 中创建的元素与您的自定义类中的相关属性联系起来?
标签: ios storyboard uistoryboard uisegmentedcontrol uistepper