I am using the standard facebook connect butto开发者_运维技巧n with the method
FBLoginButton *loginButton = [[[FBLoginButton alloc] init] autorelease];
[self.view addSubview: loginButton];
and It places it where I dont want it. How can I set that subviews location?
Access the view's frame
property:
loginButton.frame = CGRectMake(originX, originY, sizeWidth, sizeHeight);
You set a view's origin relative to their parent view using setFrameOrigin:
NSPoint origin = NSMakePoint(0,0);
FBLoginButton *loginButton = [[[FBLoginButton alloc] init] autorelease];
[loginButton setFrameOrigin:origin];
[self.view addSubview: loginButton];
Like every other UIView, you can use its frame property to specify its size and position.
You can also use the center property to just reposition the control.
精彩评论