Reputation: 37
I have been using VB.NET for a while and I switched to Xcode 4.
In the VB.NET environment, I used to type the following command in a button:
if TextBox1.text="" then
MessageBox.Show("You can't leave the textbox empty!, "Error!")
else
Label1.text = TextBox1.text
That is just an example. In Xcode, I want to do the same thing except for I want to have a Pop-Up Alert (in the iPhone) instead of the MessageBox in VB.NET.
Any Ideas?
Upvotes: 2
Views: 11224
Reputation: 28720
Here you go
if ([TextBox1.text isEqualToString:@""]){
UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"You can't leave the textbox empty!"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[errorAlert show];
[errorAlert release];
} else {
Label1.text = TextBox1.text;
}
Upvotes: 5