- //
- // ViewController.m
- // test
- //
- // Created by admin on 2014/12/6.
- // Copyright (c) 2014年 itcast. All rights reserved.
- //
- #import "ViewController.h"
- @interface ViewController ()
- @property(weak, nonatomic) IBOutlet UIView* mimage;
- @end
- @implementation ViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
-
- //取得萤幕尺寸
- CGSize screenSize = [UIScreen mainScreen].bounds.size;
- //x=0,y=0,w=0,h=0
- CGRect frame = CGRectZero;
- frame.size =screenSize;
-
- //设定元件位置
- self.mimage.frame = frame;
- }
- @end
复制代码 你是不是没有拉IBOutlet,以上代码是使用IBOutlet的方式
不拉IBOutlet也行,mimage这个元件要加入下面这行
- [self.view addSubview:self.mimage];
复制代码
|