【问题标题】:Cannot add dznsegmentedcontrol to UIView无法将 dznsegmentedcontrol 添加到 UIView
【发布时间】:2014-07-02 23:39:23
【问题描述】:

我正在尝试将以下控件添加到视图控制器内的 UIView。该控件似乎没有出现在视图内。

https://www.cocoacontrols.com/controls/dznsegmentedcontrol

NSArray *items = @[@"Kicks", @"Re-kicks", @"Interested"];

DZNSegmentedControl *control = [[DZNSegmentedControl alloc] initWithItems:items];
control.tintColor = [UIColor blueColor];
control.delegate = self;
control.selectedSegmentIndex = 2;
[control addTarget:self action:@selector(selectedSegment:) forControlEvents:UIControlEventValueChanged];

[cell.segmentView addSubview:control];

【问题讨论】:

  • “它似乎不起作用”不是一个问题。请说出您的期望和实际发生的情况。

标签: ios objective-c uiview uisegmentedcontrol


【解决方案1】:

我认为您正在寻找的是以某种方式添加控制器。

[self.navigationController.navigationBar addSubview:self.control];

或在 dzenbot 给出的示例代码中:

self.tableView.tableHeaderView = self.control;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-19
    • 2014-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-12
    • 2015-12-19
    相关资源
    最近更新 更多