IOS中UIButton控件的应用

UIButton *Button_Login = [UIButton buttonWithType:UIButtonTypeRoundedRect];         //边框设置
    Button_Login.frame = CGRectMake(143, 50, 40, 30);                                   //位置及大小
    Button_Login.backgroundColor = [UIColor clearColor];
    [Button_Login setTitle:@"Login" forState:UIControlStateNormal];                      //按钮的提示字
    Button_Login.titleLabel.font = [UIFont fontWithName:@"helvetica" size:12];           //设置字体大小
    [Button_Login setBackgroundImage:[UIImage imageNamed:@"28.png"] forState:UIControlStateNormal];  //设置背景图片
    [self.view addSubview:Button_Login];
    [Button_Login addTarget:self action:@selector(Login_Judge) forControlEvents:UIControlEventTouchDown];  //触发到函数Login_Judge中

posted on 2012-03-30 11:05  爱直至成伤lie  阅读(3812)  评论(0)    收藏  举报