iPhone开发技巧之私有API --- UIButton

如下图所示,指定 100 以上的UIButton的buttonWithType:就可以得到非公开的按钮风格。 
 

其中 100 ~ 102 是 UINavigationButton 风格的按钮 
 

Java代码  收藏代码
  1. UIButton *button;  
  2.     button = [UIButton buttonWithType:100];   
  3.     button.frame = CGRectMake(10.0f, 10.0f, button.frame.size.width, button.frame.size.height);  
  4.     [button setTitle:[NSString stringWithUTF8String:"100 番のボタン"] forState:UIControlStateNormal];  
  5.     [self.view addSubview:button];  
  6.     button = [UIButton buttonWithType:101];   
  7.     button.frame = CGRectMake(10.0f, 50.0f, button.frame.size.width, button.frame.size.height);  
  8.     [button setTitle:[NSString stringWithUTF8String:"101 番のボタン"] forState:UIControlStateNormal];  
  9.     [self.view addSubview:button];  
  10.     button = [UIButton buttonWithType:102];  
  11.     button.frame = CGRectMake(10.0f, 90.0f, button.frame.size.width, button.frame.size.height);  
  12.     [button setTitle:[NSString stringWithUTF8String:"102 番のボタン"] forState:UIControlStateNormal];  
  13.     [self.view addSubview:button];  



 

Java代码  收藏代码
  1. button = [UIButton buttonWithType:110];  
  2.     button.frame = CGRectMake(10.0f, 130.0f, 140.0f, 40.0f);   
  3.     [button setTitle:[NSString stringWithUTF8String:"110 番のボタン"] forState:UIControlStateNormal];  
  4.     [self.view addSubview:button];  


 

Java代码  收藏代码
    1. button = [UIButton buttonWithType:111];  
    2.     button.frame = CGRectMake(10.0f, 180.0f, 180.0f, 40.0f);   
    3.     [button setTitle:[NSString stringWithUTF8String:"111 番のボタン"] forState:UIControlStateNormal];  
    4.     [self.view addSubview:button]; button = [UIButton buttonWithType:111];  
    5.     button.frame = CGRectMake(10.0f, 230.0f, 180.0f, 40.0f);  
    6.     [button setTitle:[NSString stringWithUTF8String:"111 番のボタン"] forState:UIControlStateNormal];  
    7.     [button setTintColor:[UIColor redColor]];   
    8.     [self.view addSubview:button]; button = [UIButton buttonWithType:111];  
    9.     button.frame = CGRectMake(10.0f, 280.0f, 180.0f, 40.0f);   
    10.     [button setTitle:[NSString stringWithUTF8String:"111 番のボタン"] forState:UIControlStateNormal];  
    11.     [button setTintColor:[UIColor blueColor]];   
    12.     [self.view addSubview:button];

posted on 2012-09-10 22:17  barani  阅读(329)  评论(0编辑  收藏  举报

导航