Reputation: 19303
This code worked great inside a UITableViewCell subclass on iOS 5 and 6:
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellEditControl"]) {
CGRect newFrame = subview.frame;
//Use your desired x value
newFrame.origin.x = 280;
subview.frame = newFrame;
}
While debugging my app on iOS 7 i've found that all the subviews above are called UITableViewCellContentView
and there is no way knowing where the UITableViewCellEditControl
subview is.
Is there a better solution for doing the above?
Upvotes: 1
Views: 1145
Reputation: 19303
While debugging this I've found that all the subviews in iOS 7 are now called 'UITableViewCellEditControl". I tried logging all the subviews subviews and found that UITableViewCellEditControl
is now a subview of a subview. This is an ugly temporary solution:
for (UIView *subview in self.subviews)
{
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellEditControl"]) {
CGRect newFrame = subview.frame;
newFrame.origin.x = 280;
subview.frame = newFrame;
}
else
{
if(IS_OS_7_OR_LATER)
{
for(UIView *subsubview in subview.subviews)
{
if ([NSStringFromClass([subsubview class]) isEqualToString:@"UITableViewCellEditControl"]) {
CGRect newFrame = subsubview.frame;
newFrame.origin.x = 280;
subsubview.frame = newFrame;
}
}
}
}
Upvotes: 1