//普通bbutton

    UIButton *nearBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    nearBtn.frame = CGRectMake(115.0f, 150.0f, 88.0f, 40.0f);
    NSString *near_btnName = [NSString stringWithFormat:@"test button"];
    [nearBtn setTitle:near_btnName forState:UIControlStateNormal];
    [nearBtn setTitleColor: [UIColor blackColor] forState: UIControlStateNormal];
    [nearBtn addTarget:self action:@selector(go_nearPage:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:nearBtn];

 

//自製底色button

    #import <QuartzCore/QuartzCore.h>

    introBtn = [UIButtonbuttonWithType:UIButtonTypeCustom];

    introBtn.frame = CGRectMake(10, addToMyPocket.frame.origin.y+addToMyPocket.frame.size.height +20, 60, btn_height);

    [introBtnsetTitle:@"intro"forState:UIControlStateNormal];

    [introBtnsetTitleColor:[UIColorblackColor] forState:UIControlStateNormal];

    [introBtn.titleLabelsetFont:[UIFontfontWithName:@"Helvetica"size:16]];

    [[introBtnlayer] setCornerRadius:8.0f];

    [[introBtnlayer] setBorderWidth:1.0f];

    introBtn.tag = 0;

    [[introBtnlayer] setBorderColor:[UIColorlightGrayColor].CGColor];

    [introBtnaddTarget:selfaction:@selector(btn_change:) forControlEvents:UIControlEventTouchUpInside];

    [introBtnsetBackgroundColor:UIColorFromRGB(0xd7d7d7)];

//自制圖像button

    NSString *fb_path = [[NSBundle  mainBundle] pathForResource:@"btn_FB"ofType:@"png"];

    UIImage *fb_img = [UIImage  imageWithContentsOfFile:fb_path];

    UIButton *fbBtn = [UIButton  buttonWithType:UIButtonTypeCustom];

    fbBtn.frame = CGRectMake(full_width-register_img.size.width, full_height-fb_img.size.height, register_img.size.width,register_img.size.height);

    [fbBtn setBackgroundImage:fb_img forState:UIControlStateNormal];

    [fbBtn addTarget:self  action:@selector(fblogin:) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:fbBtn];

arrow
arrow
    全站熱搜

    result945 發表在 痞客邦 留言(0) 人氣()