iphone - How can I move the detail disclosure of a cell from the default location to another location? -
how can move detail disclosure of cell default location location? in objective-c obliviously.
create custom cell overriding uitableviewcell, haven't done yet, , poste method below in implementation file.
-(void)layoutsubviews { [super layoutsubviews]; (uiview *subview in self.subviews) { if ([nsstringfromclass([subview class]) isequaltostring:@"uibutton"]) { //just example, change frame wish here. cgrect newframe = subview.frame; newframe.origin.y -= 15; subview.frame = newframe; } } }
this approach can used edit default components of tableviewcell, disclosure, delete button when editing, etc. , not mess views put inside cell, because manual added views inside contentview
property.
works charm, keep in mind changing state of subview that's not accessible outside of view it's never practice (although not cause rejection of app).
a more elegant solution use uiimageview custom disclosure , put inside cell in position want.
edit:
after comment below , downvote think it's important point out something:
all views put inside cell, inside uitableviewcell property "contentview". so, though have buttons inside cell, not listed in enumeratino above, because subviews of contentview, code still work.
please, little research uitableviewcellcontentview more details.
my point here show yes, it's possible move default disclosure if that's looking for, did tell that's not better solution.
Comments
Post a Comment