How I can make button programmatically? I think it is UIButton alloc initwithframe, but I don't know how to use this to make my button?
Use the following code:
UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; closeButton.frame = CGRectMake(20, 20, 200, 44); [closeButton setTitle:@"Close View!" forState:UIControlStateNormal]; [closeButton addTarget:self action:@selector(myAction:) forControlEvents:UIControlEventTouchUpInside]; [myView addSubview:closeButton];