ios - UIAlertview error: Unable to simultaneously satisfy constraints -
this question has been asked many times, have tried of options, , none of them seem work. in ios app, whenever seek create alert view, happens:
http://i61.tinypic.com/kalnk2.png
i don't know do. when click ok, error: (this entire error)
http://pastebin.com/raw.php?i=beegbjj8
my code is:
@implementation ajsettingsviewcontroller -(nsstring*) datafilepath{ nsarray *path = nssearchpathfordirectoriesindomains(nslibrarydirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [path objectatindex:0]; homecoming [documentsdirectory stringbyappendingpathcomponent:filename]; } -(void) savefile{ nsmutablearray *array = [[nsmutablearray alloc] init]; [array addobject:country]; [array addobject:state]; [array addobject:town]; [array addobject:zipcode]; [array addobject:name]; [array writetofile:[self datafilepath] atomically:yes]; //[array dealloc]; } - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization } homecoming self; } - (void)viewdidload { zipcodetextfield.translatesautoresizingmaskintoconstraints = no; [view settranslatesautoresizingmaskintoconstraints:no]; [super viewdidload]; // additional setup after loading view. } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } -(ibaction)zipcodelookup:(id)sender{ [zipcodetextfield resignfirstresponder]; zipcodetextfield.translatesautoresizingmaskintoconstraints = no; zipcode = zipcodetextfield.text; if(zipcode.length >0){ nsstring *url = [nsstring stringwithformat:@"http://ziptasticapi.com/%@",zipcode]; url = [url stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; nsurlrequest *req = [nsurlrequest requestwithurl:[nsurl urlwithstring: url] cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:60.0]; nsurlconnection *connection = [[nsurlconnection alloc] initwithrequest:req delegate:self]; [connection start]; nserror *noconnection; nsstring *htmlpage = [nsstring stringwithcontentsofurl:[nsurl urlwithstring: url] encoding:nsasciistringencoding error:&noconnection]; //nslog(htmlpage); if ([htmlpage rangeofstring:@"error"].location == nsnotfound) { htmlpage = [htmlpage stringbyreplacingoccurrencesofstring:@"{" withstring:@""]; htmlpage = [htmlpage stringbyreplacingoccurrencesofstring:@"}" withstring:@""]; htmlpage = [htmlpage stringbyreplacingoccurrencesofstring:@":" withstring:@""]; htmlpage = [htmlpage stringbyreplacingoccurrencesofstring:@"\"" withstring:@""]; htmlpage = [htmlpage stringbyreplacingoccurrencesofstring:@"country" withstring:@""]; htmlpage = [htmlpage stringbyreplacingoccurrencesofstring:@"city" withstring:@""]; htmlpage = [htmlpage stringbyreplacingoccurrencesofstring:@"state" withstring:@""]; nslog(htmlpage); } else { zipcodetextfield.text = @""; uialertview *message = [[uialertview alloc] initwithtitle:@"error" message:@"we unable locate zipcode. please seek again" delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; message.translatesautoresizingmaskintoconstraints = no; [message show]; } }else{ uialertview *message = [[uialertview alloc] initwithtitle:@"error" message:@"please come in zipcode" delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; message.translatesautoresizingmaskintoconstraints = no; [message show]; } } -(ibaction)exitkeyboard:(id)sender{ [zipcodetextfield resignfirstresponder]; } @end i @ absolute wits end here, help appreciated.
thanks
message.translatesautoresizingmaskintoconstraints = no;
do not set uialertview - alert view , private manager decide how layout works.
ios iphone objective-c uiview
No comments:
Post a Comment