ios - Adding subview to static UITableViewCell not working -


i have static uitableview. i'm trying programmatically add uisegmentedcontrol third cell. here code:

uisegmentedcontrol *segment = [[uisegmentedcontrol alloc] initwithitems:@[@"first", @"second"]]; segment.frame = cgrectmake(0, 0, 50, 30);  uitableviewcell *cell = [self.tableview cellforrowatindexpath:[nsindexpath indexpathforrow:2 insection:1]]; [cell.contentview addsubview:segment]; 

when code called, segmentedcontrol isn't added.

i tried adding uilabel, , doesn't work either.

i can't place in method because i'm adding segmentedcontrol when button selected

when have static tableview, can connect outlets cells directly , manipulate simple subviews. connect outlet , use code add subviews. work

update

add subviews using following code:

[cell addsubview:segment]; 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -