Press the existing button to create a new button yourself and add the event for the new button, so when you click the pop-up prompt box.
Add to Viewcontroller.h
@property (weak, nonatomic) iboutletUIButton *addbutton;
Add a response event to this button AddButton
Join in the VIEWCONTROLLER.M
-(ibaction) AddButton: (ID) Sender {
// dynamically add a button
CGRect frame = cgrectmake(0,0, +) ;
UIButton *button = [UIButtonbuttonwithtype: Uibuttontyperoundedrect];
button. frame = frame;
[Button settitle:@ " new Dynamic button added "forstate: UIControlStateNormal];
button. BackgroundColor = [uicolor RedColor];
button. tag =+;
[Button addTarget:self action:@selector(buttonclicked :)forcontrolevents:uicontroleventtouchupinside];
[Self. View addsubview: button];
}
// This is the response function of the new button
-(ibaction) buttonclicked: (ID) Sender {
uialertview *alert = [[ uialertview< Span style= "COLOR: #000000" > alloc ] Span style= "COLOR: #3d1d81" >initwithtitle : @ " hint "
message:@ " click on Dynamic button!
"
delegate: Self
cancelbuttontitle:@ " OK "
otherbuttontitles:nil];
[Alertshow];
}
Copyright notice: This article Bo Master original article. Blog, not reproduced without consent.
IOS Dynamic Join button