如果我将此UIImageView设置为IBOutlet,它可以正常工作并显示在SIM卡中。但是以编程方式它不起作用。我想我错过了一步或忘记了一行代码。
声明为
@property (nonatomic,retain) UIImageView *circleView;
和实施
self.circleView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
self.circleView.center = self.view.center;
[self.view addSubview:circleView];
答案 0 :(得分:2)
您只是忘记初始化UIImageView
,这就是为什么它无效......
self.circleView = [[UIImageView alloc] init];
self.circleView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
self.circleView.center = self.view.center;
[self.view addSubview:circleView];