Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create a button in uiview programmatically in iphone

Tags:

ios

uikit

iphone

In my iPhone application, how to add next and previous buttons in uiview programmatically?

like image 442
user549767 Avatar asked Jan 24 '11 06:01

user549767


1 Answers

You can create dynamic buttons using the following code

    UIButton *but=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    but.frame= CGRectMake(200, 15, 15, 15);
    [but setTitle:@"Ok" forState:UIControlStateNormal];
    [but addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:but];
like image 83
KingofBliss Avatar answered Oct 02 '22 23:10

KingofBliss