-1

如果我将此 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];
4

1 回答 1

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];
于 2012-08-27T04:16:52.913 回答