Arcadian
Arcadian

Reputation: 4350

how to make UIView subview a fixed size programmatically

I have a UIView subclass that I want to be 50x50; When I load it it always takes up the entire screen How can I solve this?

Upvotes: 1

Views: 2345

Answers (1)

runmad
runmad

Reputation: 14886

Posting some code would help us help you, but here's how you set the frame of any UIView subclass:

// When creating the view...
UIView *yourView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];

// or after having created the view...
yourView.frame = CGRectMake(0, 0, 50, 50);
// ... or
[yourView setFrame:CGRectMake(0, 0, 50, 50)];

Upvotes: 1

Related Questions