uialertview

use UIAppearance methods for customizing UIAlertView

╄→尐↘猪︶ㄣ 提交于 2019-12-05 19:47:35
I know that UIAlertView conforms to UIAppearance and UIAppearanceContainer . But how do I use UIAppearance to customize/style UIAlertView ? I am not able to find it over the net. You can't use UIAppearance to customise UIAlertView . UIAlertView only shows as having UIAppearance because UIView conforms to UIAppearance and UIAlertView is a subclass of UIView . It doesn't actually implement it though. If you want to use UIAlertView functionality, modally view, etc... you can subclass it. Here an example: http://www.albertopasca.it/whiletrue/2012/07/objective-c-modal-view-navigation-tabbar

How does [UIAlertView show] work?

寵の児 提交于 2019-12-05 17:45:28
问题 I want to do something similar to UIAlertView, ie - without reference to any UIView or UIViewController, present a UIViewController on top of all windows using presentModalViewController. Looking at the documentation I can't find a way in which this is possible! In OS4, there is something like this: UIWindow *window = [UIApplication sharedApplication].keyWindow UIViewController *rootViewController = window.rootViewController ...but this is not possible in OS3. Does anyone know how to achieve

tony million Reachability says unreachable when connected

核能气质少年 提交于 2019-12-05 17:31:15
问题 I have searched but have not found an issue like mine. I'm sure it's something I have over looked . I am using tony million's reachability block method. it is working good when i have internet then no internet. the alert comes up and works just fine. but, when i have no internet and then i get internet the same alert pops up my code is -(void)reachabilityBlock { // allocate a reachability object Reachability * reach = [Reachability reachabilityWithHostname:@"www.google.com"]; // tell the

clickedButtonAtIndex in appdelegate is not called

让人想犯罪 __ 提交于 2019-12-05 16:58:12
I am calling UIAlert with 2 buttons "Cancel" and "OK" in MyapplicationAppDelegate.m file , the alert is called but on tap of "Cancel" or "OK" button -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex method is not called. I have added UIAlertViewDelegate in the MyapplicationAppDelegate.h file as below #import UIKit/UIKit.h @interface MyapplicationAppDelegate: NSObject UIApplicationDelegate,UIAlertViewDelegate { .. } I want to know what else is required. I am not sure whether its your typo while posting the question but you should call the delegate within <..

change position of cancel button in UIAlertView?

一笑奈何 提交于 2019-12-05 14:48:27
问题 I noticed that when I delete an app from my iPhone home screen, the alert view that appears shows a Delete button on the left and Cancel on the right. However, when I build a delete function within my app using UIAlertView, the buttons only seem to display with Cancel on the left and Delete on the right. I'd like my app to be consistent with the OS, but I can't figure out how to make the Cancel button appear first. Does anyone know? UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@

UIAlertController not working in iOS 9

我的梦境 提交于 2019-12-05 10:37:38
I have added the UIAlertController code showing login and password textfields, it works for iOS 8 but in iOS 9 not works. The textfields shrinks as shown in figure below The code I am trying is as follows : - (void)toggleLoginLdap:(UIViewController *)currentVC { if ([UIAlertController class]) { self.alertController= [UIAlertController alertControllerWithTitle:@"Title of Msg" message:@"Hello" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action){ NSString *userName = self

How do I show all the buttons text with normal font on UIAlertView in ios

随声附和 提交于 2019-12-05 10:29:06
In my iOSproject I have an UIAlertView with 3 buttons on it , but the last button text is defaulted to bold font like this... , how can I set the font style of third button text to normal ? following is the code used to create that alert view UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"test" message:@"testTestTest" delegate:Nil cancelButtonTitle:nil otherButtonTitles:@"first",@"second",@"third" ,nil]; [alert show]; I spent some time on this and went to dig along subview structure of present view controller when UIAlertView is presented. I am able to show normal font to all button

Simple UIAlertView with NSAttributedString(s)

淺唱寂寞╮ 提交于 2019-12-05 10:09:48
I am looking for a simple way to use NSAttributedString with a very simple message box similar to: NSString *new_item = [NSString stringWithFormat:@"<span style=\"font-family: Helvetica Neue; font-size: 12.0\">%@</span>", @"MOTD HTML String downloaded from website"]; NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[new_item dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MOTD" message:attrStr delegate:nil

UIAlertView Buttons(subviews) is not Showing in iOS 7

谁说我不能喝 提交于 2019-12-05 09:16:19
UIAlertView is working fine in ios 6 with below code .But when it comes to ios 7 the subviews ( "yes" and "no" buttons in my code ) is not showing when alertview is called only text message is showing .Can anyone tell me how to resolve this problem ? viewController.m file [Utilities prCustomAlert:@"Textmessage" inTitle:@"Alert view title" delegate:self inTag:300]; CustomAlertView *alertView = [Utilities sharedUtility].customAlertView; alertView.numberOfBtns = 2; UIButton *btn= (UIButton *)[alertView viewWithTag:10]; [btn setTitle:@"no" forState:UIControlStateNormal]; [btn addTarget:self action

Hide UIAlertView programmatically?

孤人 提交于 2019-12-05 08:26:14
问题 Is there a way to hide UIAlertView programmatically? Actually I have added a UITextField in UIAlertView and I want to perform the same operation as on "Ok" button press when a user hits the keyboard return key. 回答1: Call [theAlertView dismissWithClickedButtonIndex:0 animated:YES]; when you handle the return key. 来源: https://stackoverflow.com/questions/3853887/hide-uialertview-programmatically