UIButton

you can add custom button to a view uncomment the code that u require

CGRect frame = CGRectMake(0.0, 0.0, 100.0, 40.0);
//UIImage *buttonImage = [UIImage imageNamed:@"grayButton.png"];
UIButton *stopButton = [[UIButton alloc] initWithFrame:frame];
[stopButton setTitle:@"Button" forState:UIControlStateNormal];
[stopButton setTitleColor:[UIColor blackColor] forState:UIControlEventTouchDown];
[stopButton setBackgroundImage:buttonImage forState:UIControlStateNormal];
stopButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
stopButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
//[stopButton addTarget:self action:@selector(stopAction:) forControlEvents:UIControlEventTouchUpInside];
[stopButton setBackgroundColor:[UIColor clearColor]];
// then add the button to a UIView like this:
// [myView addSubview: stopButton];

Comments