Wednesday, 21 August 2013

Move button in a ScrollView - iOS

Move button in a ScrollView - iOS

I currently have a view and within it I have a scrollView. On that
scrollView I have a button and a UITableView.
Given some condition, I want to move those two things up. I am currently
doing this:
tempFrame = [addressTableView frame];
tempFrame.origin.x = 0.0;
tempFrame.origin.y = 2.0;
tempFrame.size.width = 320.0;
tempFrame.size.height = 103.0;
[addressTableView setFrame:tempFrame];
// [self.scrollView addSubview:self.addressTableView]; (does not do
anything)
tempFrame = [buttonContinue frame];
tempFrame.origin.x = 20.0;
tempFrame.origin.y = 40.0;
tempFrame.size.width = 150.0;
tempFrame.size.height = 25.0;
[buttonContinue setFrame:tempFrame];
// [self.scrollView addSubview:self.buttonContinue]; (does not do
anything)
This method works fine on views with no scrollView.
Any tips on how to correctly move objects in a scrollView would be greatly
appreciated.
Thanks.

No comments:

Post a Comment