XCode的一些API

来源:互联网 发布:mysql解压安装教程 编辑:程序博客网 时间:2024/05/19 03:45

UI控件:
  设按钮标题:[but SetTitle @"" forState:UIControlStateNormal]; //注,好懒的设计,无语
  旋转:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
  return (interfaceOrientation == UIInterfaceOrientationPortrait ||
          interfaceOrientation == UIInterfaceOrientationLandScapeLeft);
}
绘图API:

 

- (void)drawRect:(CGRect)rect{
    CGContextRef bluecontext = UIGraphicsGetCurrentContext();
   
CGContextSetLineWidth(bluecontext, 2.0);
   
CGContextSetStrokeColorWithColor(bluecontext, [UIColor blueColor].CGColor);
   
CGContextMoveToPoint(bluecontext, 1, 1);
   
CGContextAddLineToPoint(bluecontext, 100, 100);
   
CGContextSetStrokeColorWithColor(bluecontext, [UIColor redColor].CGColor);
   
CGContextAddLineToPoint(bluecontext, 200, 100);
   
CGContextStrokePath(bluecontext);
}


类:
连接口   (IBOutlet)
连接方法 -(IBAction)

原创粉丝点击