adding uiview as a subview to the main view

前端 未结 3 1978
别跟我提以往
别跟我提以往 2021-01-06 03:10

i want to add an UIView for small size as a subview to existing view.

i have a UIViewController pushed with a nib name which is the main vi

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-06 03:31

    UIView needs to be alloc'ed and init'ed with a frame:

    CGRect frame = CGRectMake(x, y, width, height); // Replacing with your dimensions
    UIView *view = [[UIView alloc] initWithFrame:frame];
    

提交回复
热议问题