Wednesday, September 25, 2013

UIViewController's frame can not be modified

I want to modify the view of UIViewController next frame, when modified in viewDidLoad is right

But why ddd function inside print out is the same as before with no modification of it? (No other code)

- (Void) viewDidLoad
{
[Super viewDidLoad];
/ / Do any additional setup after loading the view.

CGRect frame = self.view.frame;

frame.size.height - = 100;
self.view.frame = frame;

NSLog (@ "Rollrock-% f-% f", self.view.frame.origin.y, self.view.frame.size.height);

NSLog (@ "Rollrock ~% f-% f", self.view.bounds.origin.y, self.view.bounds.size.height);

UIButton * btn = [[UIButton alloc] initWithFrame: CGRectMake (0, 0, 100, 100)];
[Btn addTarget: self action: @ selector (ddd) forControlEvents: UIControlEventTouchDown];

[Self.view addSubview: btn];


self.view.backgroundColor = [UIColor redColor];
}

- (Void) ddd
{
NSLog (@ "Rollrock-% f-% f", self.view.frame.origin.y, self.view.frame.size.height);

NSLog (@ "Rollrock ~% f-% f", self.view.bounds.origin.y, self.view.bounds.size.height);
}

Reply:
self.view.frame = CGRectMake (0, 0, self.view.frame.size.width, self.view.frame.size.height - 100);
Reply:
Did not see the method you call ddd

No comments:

Post a Comment