Friday, 18 May 2012

how to create custom button in iphone sdk

detailsButton = [UIButton buttonWithType:UIButtonTypeCustom];
    detailsButtonImage = [UIImage imageNamed:@"read-more.png"];
    [detailsButton setBackgroundImage:detailsButtonImage forState:UIControlStateNormal];
    detailsButton.frame = CGRectMake(250, 40, 60, 30);
    detailsButton.tag = indexPath.row;
    [detailsButton addTarget:self action:@selector(ShowDetails:) forControlEvents:UIControlEventTouchUpInside];
    NSLog(@"%d", detailsButton.tag);









-(IBAction)ShowDetails:(id)sender{
//code here
}

No comments:

Post a Comment