Posts

Showing posts with the label UIAlertView

Show Alert Message snippet using UIAlertView

Use this when you just want to alert user without any callback for action - ( void ) showAlert: ( NSString *) title withMessage: ( NSString *) message isRedText: ( BOOL ) isRedText withButton: ( NSString *) btnText {     // open a alert with an OK     UIAlertView *alertView = [[ UIAlertView alloc ] init ];     [alertView setDelegate : nil ];     [alertView setTitle : title];     [alertView setMessage : message];     [alertView addButtonWithTitle : btnText];          UILabel *theBody = [alertView valueForKey : @"_bodyTextLabel" ];     if (isRedText) {         [theBody setTextColor :[ UIColor redColor ]];     }          [alertView show ]; } Notice that delegate of alertView is nil, if you want some callback when user press button, set delegate to self (or anything response for action), in .h file u...