zoukankan      html  css  js  c++  java
  • 创建按钮的两种方法

    1、动态创建

     btnfont = [UIButton buttonWithType:UIButtonTypeRoundedRect];
         [btnfont setFrame:CGRectMake(1001012040)];
         [btnfont addTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
         [btnfont setTitle:@"字体" forState:UIControlStateNormal];
         btnfont.backgroundColor=[UIColor clearColor];
         [self.view addSubview:btnfont];
     

      

    2、在xib文件中已经创建好,通过tag获取按钮 

    UIButton *testButton= (UIButton*)[self.view viewWithTag:100];
        [testButton addTarget:self action:@selector(test:) forControlEvents:UIControlEventTouchUpInside];

      

    注册事件

    -(void) test: (id) sender{
        UIAlertView *av = [[[UIAlertView alloc] initWithTitle:@"ceshi" message:@"test11111" delegate:nil cancelButtonTitle:@"OK"otherButtonTitles:nil] autorelease];
        [av show];
    }

      

  • 相关阅读:
    快速幂
    1112个人赛,最长回文串常见算法讨论
    11-05-sdust-个人赛赛后随想
    UVA 1149 Bin Packing
    UVa 1608,Non-boring sequences
    UVa 10954,Add All
    UVa 714,Copying Books
    Careercup
    Careercup
    Careercup
  • 原文地址:https://www.cnblogs.com/weifeng/p/2200189.html
Copyright © 2011-2022 走看看