阅读背景:

改变视图的背景颜色每点击一个按钮在iPhone。

来源:互联网 
-(IBAction) changeColOnClick:(id)sender
{
    NSArray *colors = [NSArray arrayWithObjects:@"[UIColor brownColor]",@"[UIColor blackColor]",@"[UI greenColor]",@"[UIColor redColor]", nil];

    self.view.backgroundColor = [colors objectAtIndex:i];
    // ERROR::changebackground[1089:207] -[NSCFString CGColor]: unrecognized selector sent to instance 0x357c

    //label.text = [colors objectAtIndex:i]; //i is defined in the implementation
    i++;

    if(i==[colors count]-1)
    {
        i=0;
    }
}
-(IBAction) changeColOnClick:(id)sender
{
    N



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: