Note that there are some explanatory texts on larger screens.

plurals
  1. POModal view not showing on device
    text
    copied!<p>I am using modal views in my iphone application. The problem is that the views are working on the simulator but when I am installing it on the device, instead of the modal views,instead it shows a white blank screen . Anyone encountered this problem before? How do i solve this? The following is the code. </p> <pre><code>#import "ResetPWD.h" #import "WebServiceController.h" #import "ProductAppDelegate.h" @implementation ResetPWD @synthesize oldPWD; @synthesize newPWD; @synthesize newPWD2; @synthesize password1; @synthesize password2; -(IBAction)done:(id)sender { NSString *pwd = oldPWD.text; NSString *pwd1 = newPWD.text; NSString *pwd2 = newPWD2.text; if(!self.oldPWD.text ) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Please Enter Old Password." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; [alert release]; return; } if(!self.newPWD.text ) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Please Enter New Password." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; [alert release]; return; } if ([pwd1 length]&lt;6) { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"New password should be atleast 6 characters long" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; [alert release]; return; } if (![pwd1 isEqualToString:pwd2]) { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"Passwords do not match" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; [alert release]; return; } password1 = pwd; password2 = pwd1; NSMutableArray *data = [[NSMutableArray alloc]init]; [data addObject:password1]; [data addObject:password2]; WebServiceController *webCall = [[WebServiceController alloc]init]; NSDictionary *dict = [webCall resetPWD:data]; NSString * nVal = [dict objectForKey:@"ErrorCode"]; NSString *errorDesc = [dict objectForKey:@"ErrorType"]; NSString *errorString = [dict objectForKey:@"ErrorString"]; int n=[nVal integerValue]; if(n&gt;=3) { errorString=[[NSString alloc]initWithFormat:@"%@\nProceed to broker registration.",errorString]; } UIAlertView *successAlert=[[UIAlertView alloc]initWithTitle:errorDesc message:errorString delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [successAlert show]; [successAlert release]; [self.parentViewController dismissModalViewControllerAnimated:YES]; } -(IBAction)cancel:(id)sender { [self.parentViewController dismissModalViewControllerAnimated:YES]; } - (void)textFieldDidBeginEditing:(UITextField *)textField { CGRect textFieldRect = [self.view.window convertRect:textField.bounds fromView:textField]; CGRect viewRect = [self.view.window convertRect:self.view.bounds fromView:self.view]; CGFloat midline = textFieldRect.origin.y + 0.5 * textFieldRect.size.height; //if (textField == usernameField) // midline+=20; CGFloat numerator = midline - viewRect.origin.y - MINIMUM_SCROLL_FRACTION * viewRect.size.height; CGFloat denominator = (MAXIMUM_SCROLL_FRACTION - MINIMUM_SCROLL_FRACTION) * viewRect.size.height; CGFloat heightFraction = numerator / denominator; if (heightFraction &lt; 0.0) { heightFraction = 0.0; } else if (heightFraction &gt; 1.0) { heightFraction = 1.0; } animatedDistance = floor(PORTRAIT_KEYBOARD_HEIGHT * heightFraction); CGRect viewFrame = self.view.frame; viewFrame.origin.y -= animatedDistance; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION]; [self.view setFrame:viewFrame]; [UIView commitAnimations]; } - (void)textFieldDidEndEditing:(UITextField *)textField { CGRect viewFrame = self.view.frame; viewFrame.origin.y += animatedDistance; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION]; [self.view setFrame:viewFrame]; [UIView commitAnimations]; } - (BOOL)textFieldShouldReturn:(UITextField *)textField { // the user pressed the "Done" button, so dismiss the keyboard [textField resignFirstResponder]; return NO; } // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. /* - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization. } return self; } */ /* // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; } */ /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations. return (interfaceOrientation == UIInterfaceOrientationPortrait); } */ - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc. that aren't in use. } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [super dealloc]; } @end </code></pre> <p>this view is not showing on the device, but showing on the simulator. also the designing is done in a xib file.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload