UIButton 用法

1 .h

-(IBAction) buttonClick:(id)sender;

 

2 .m

-(IBAction) buttonClick:(id)sender

{

    UIButton *button=(UIButton *)sender; //UIButton *button[[UIButton alloc] init]];

    NSString *title=[NSString stringWithFormat:@"Button tag is %d",button.tag];

    NSString *message=[button currentTile];

    UIAlertView *alert=[[UIAlertView alloc] initWithTitle:title message:message delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];

 

   [alert Show];

   [alert release]; 

 

3 run result:

 

posted @ 2012-07-04 16:40  大树2  阅读(535)  评论(0编辑  收藏  举报