问题
I wanted to show a Settings view, so I figured I could use the pageCurl modal style. I have a UIViewController
that I am presenting from:
Settings *settings = [[[Settings alloc] initWithStyle:UITableViewStyleGrouped] autorelease];
settings.view.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
settings.modalTransitionStyle = UIModalTransitionStylePartialCurl;
settings.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:settings animated:YES];
When the page curls, to reveal my UITableViewController
below, the cells subviews
(labels and accessory views) seem to animate into position, which looks horrible:
The strange thing is, is that the animation never happens to the top cell in a section. This does not happen with other modalTransitionStyle's
so I am wondering why this could be happening. It is really becoming frustrating because I cannot figure out how to stop this from happening.
Ideas?
回答1:
If you set the autoResizingMask
property of the tableView to UIViewAutoresizingNone
, I think this won't happen. This may be a little bug in the page curl animation.
回答2:
I've noticed that the direction of this weird animation (which also happens to UIButtons), depends on the Alignment chosen in the Control section of the object's Attributes inspector (in Interface Builder). I've been tinkering with all attributes all evening and have found no solution yet. :(
Edit: so, I had three UIButton
in my view (and one UIPickerView
) that where doing this weird behavior at the same time. I created a property linking to ONE of the UIButtons
. Then, in the viewDidLoad
of this view's controller I added the following line:
_firstAffectedButton.titleLabel.autoresizingMask = UIViewAutoresizingNone;
And that fixed it for me, for all the buttons and the picker!! :? Weird, right?
Can anyone explain why this is working? I have the feeling I'm doing something stupid to fix this, but I can't see what it is.
Edit 2: Turns out there was a better and cleaner solution to this problem. See this post.
来源:https://stackoverflow.com/questions/8208513/ios-using-modal-pageflip-makes-strange-cell-animation-in-uitableviewcontroller