【问题标题】:custom class story board uisegmentcontrol uistepper自定义类故事板uisegmentedcontrol uistepper
【发布时间】: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


【解决方案1】:

我不认为你在故事板中所做的有什么问题。 如果我理解正确,您已经像我在下图中所做的那样,我有一个名为 JSLabelUILabel 的子类,更改为我的自定义类,如下所示:

我认为您在子类中可能有一些错误。也许你需要在那里修复一些东西。 如果没有关于您的子类的更多信息,将无法为您提供更多帮助。

祝你好运!

【讨论】:

    猜你喜欢
    • 2023-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-14
    • 1970-01-01
    • 2012-01-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多