开发者

How is the location of a subView set?

开发者 https://www.devze.com 2023-01-07 18:05 出处:网络
I am using the standard facebook connect butto开发者_运维技巧n with the method FBLoginButton *loginButton = [[[FBLoginButton alloc] init] autorelease];

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消