iphone - uialertview called more than once -
it's irritating ...!!!
i googled problem, found relative questions
not satisfactory answers
.
so have 1 - (ibaction)
method adds uitextfield's
values nsmutablearray
when "add"
button clicked. trying show uialertview
, if uitextfield empty.
my code :
- (ibaction)addbuttonpressed:(id)sender { if ([textfield1.text length]==0 || [textfield2.text length]==0 || !someflag) { uialertview *alert = [[uialertview alloc] initwithtitle:@"myapp" message:@"please come in valid data..." delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil]; [alert show]; [alert release]; } else { // code add together textfield's value array. } }
my problem :
whenever press "add" button empty textfield , uialertview
appears thrice.
1) first time appears "close"
button. (i have never added...) disappears within time.
2) sec time appears "ok" button. (that's added...) disappears when press "ok" button.
3) 3rd time appears "close" button again. disappears when press "close" button.
edit :
similar question : uialertview pops 3 times per phone call instead of once. can help me found solution ?
your code contains no issues. there's not 3 it's 2 alerts. here's flow of alert view:
as click onadd
button there called 2 selector (may 1 within other or 2 ibaction 1 button) contains alert view code in them now alert2 (with cancel button) called before alert1(with ok button) then alert1 called , hide alert2 now when resolve alert1(by clicking on ok button) alert2 shows 1 time again now need check "if button not connected 2 ibactions", should have no such code phone call alert in method. , check if helps.
iphone ios objective-c uibutton uialertview
No comments:
Post a Comment