2014-03-31 33 views
0

我想將以下控件添加到viewcontroller內的UIView。該控件似乎沒有出現在視圖內部。不能將dznsegmentedcontrol添加到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]; 
+0

「這似乎並不奏效」不是一個問題。請說出你的期望和實際發生的情況。 – matt

回答

0

我想你在找什麼是以某種方式添加控制器。

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

或由dzenbot得到安寧示例代碼:

self.tableView.tableHeaderView = self.control;