views:

17

answers:

3

I am using the standard facebook connect button 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?

+1  A: 

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];
Louis Gerbarg
+1  A: 

Access the view's frame property:

loginButton.frame = CGRectMake(originX, originY, sizeWidth, sizeHeight);
Alex Reynolds
A: 

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.

Vegar