yasserislam
yasserislam

Reputation: 154

Repositioning UIView causes oposite directions

In the root view controller of my project, i wrote in the

- (void)viewDidAppear:(BOOL)animated

I wrote:

self.view.center = CGPointMake(self.view.center.x-50.0, self.view.center.y);

I expected that it will be move to the left direction, but actually it goes to right direction.

The same case for Y direction..

why this ?

thanks

EDITING

I tested that: I presented this viewController modally, and I put the previews positioning code in the "viewDidAppear" part , then the coordinates seems reversed. This is the code to presenting modal viewController:

ReadingViewController * readingController = [[ReadingViewController alloc] initWithNibName:@"ReadingViewController" bundle:nil];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentModalViewController:readingController animated:NO];

I then commented this peace of code an added the View of this ViewController into the super view and not changed the positioning code inside "viewDidAppear" part , and i found it is working as I expected, i.e. moved to the left by 50 pixels.

Upvotes: 0

Views: 54

Answers (1)

Mansi Panchal
Mansi Panchal

Reputation: 2357

The code you have used is working perfectly with me.Check out once for the bindings.

Upvotes: 1

Related Questions