Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Can you post some of your code? It's difficult to speculate without seeing what's going on but I'll give it a try anyway.</p> <p>You need to move the code where you connect to the server out of viewDidLoad and put it in a callback method or something. I would suggest throwing an alert with a name and password field, make your view controller the alert's delegate and then have the clickedButtonAtIndex function connect to the server.</p> <p>Example:</p> <pre><code>-(void)viewDidLoad { UIAlertView *loginAlert = [[UIAlertView alloc] initWithTitle:@"Login" message:@"Please enter your username and password below" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Login",nil]; //You might have to do some fiddling with the frame sizes to make it fit in the alert. UITextField *userNameField = [[UITextField alloc] initWithFrame:CGRectMake(originX, originY, lengthX, lengthY)]; userNameField.placeholder = @"User Name"; [loginAlert addSubview:userNameField]; //loginAlert will retain this so we release it now. [userNameField release]; [UITextField *passwordNameField = [[UITextField alloc] initWithFrame:CGRectMake(originX, originY, lengthX, lengthY)]; passwordNameField.secureTextEntry = YES; [loginAlert addSubview:passwordNameField]; [passwordNameField release] //This line tells the iPhone to stretch out your AlertView so it's big enough for your two textViews, we use 0 and 130 respectively but we only have one text field. CGAffineTransform myTransform = CGAffineTransformMakeTranslation(stretchX, stretchY); [loginAlert setTransform:myTransform]; [loginAlert show]; [loginAlert release]; } //Implement this method, it will be called when the user clicks the "login" button on your alert. -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { //Usually if they click cancel you do nothing, thats buttonIndex 0 if(buttonIndex == 1) { //Connect to the server with the correct login and password. } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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