IOS UIButton attribute settings
// Set the Custom button
// UIButton * button1 = [UIButton buttonWithType: UIButtonTypeCustom];
// Set a button for rounded corner
UIButton * button1 = [UIButton buttonWithType: UIButtonTypeRoundedRect];
Button1.frame = CGRectMake (80,250,250, 30); // coordinates of the button position
[Button1 setTitle: @ "Button1" forState: UIControlStateNormal]; // normal status button title
[Button1 setTitle: @ "highlighted state" forState: UIControlStateHighlighted]; // the title of the highlighted button
// Highlighted Halo Effect
[Button1 setShowsTouchWhenHighlighted: YES];
// Set the title Color
[Button1 setTitleColor: [UIColor redColor] forState: UIControlStateNormal];
// Set the font size of the title
[Button1.titleLabel setFont: [UIFont boldSystemFontOfSize: 20];
// Set the background color
[Button1 setBackgroundColor: [UIColor blueColor];
// The image is stretched to set the background image
[Button1 setBackgroundImage: [UIImage imageNamed: @ "1.jpg"] forState: UIControlStateNormal];
// Set the background image to keep the original size
// [Button1 setImage: [UIImage imageNamed: @ "1.jpg"] forState: UIControlStateNormal];
[[Button1 titleLabel] setShadowColor: [UIColor blackColor];
[[Button1 titleLabel] setShadowOffset: CGSizeMake (-0.5,-0.5)];
Button1.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[Self. view addSubview: button1];
// Listen for events
[Button1 addTarget: self action: @ selector (Click_Button) forControlEvents: UIControlEventTouchUpInside];
}
-(Void) Click_Button
{
NSLog (@ "clicked ...");
}
Not complete, to be updated .........