相关疑难解决方法(0)

iOS7中的UIAlertView addSubview

添加一些控件UIAlertView已在iOS7中使用addSubview方法弃用.据我所知,Apple承诺增加contentView财产.

iOS 7现已发布,我发现此属性未添加.这就是为什么我搜索一些能够为此alertView添加进度条的自定义解决方案.例如类似于TSAlertView的东西,但更适合在iOS 7中使用.

objective-c uialertview ios ios7

67
推荐指数
6
解决办法
9万
查看次数

无法在iOS7上将UITextField添加到UIAlertView ...适用于iOS 6

下面的代码适用于iOS6(以及之前的版本),但UITextField不会在iOS7中显示...有关如何在iOS7中的UIAlterView中显示UITextField的任何想法?

UIAlertView* dialog = [[UIAlertView alloc] init];
[dialog setDelegate:self];
[dialog setTitle:@"Enter ESC Score"];
[dialog setMessage:@" "];
[dialog addButtonWithTitle:@"Cancel"];
[dialog addButtonWithTitle:@"OK"];
dialog.tag = 5;

nameField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, 245.0, 25.0)];
[nameField setKeyboardType:UIKeyboardTypeNumberPad];
[nameField becomeFirstResponder];
[nameField setBackgroundColor:[UIColor whiteColor]];
[dialog addSubview:nameField];
CGAffineTransform moveUp = CGAffineTransformMakeTranslation(0.0, 0.0);
[dialog setTransform: moveUp];
[dialog show];
[dialog release];

[nameField release];
Run Code Online (Sandbox Code Playgroud)

iOS6的代码运行显示:

在此输入图像描述

iOS7中的相同代码显示此内容(请注意UITextField如何丢失且没有键盘):

在此输入图像描述

objective-c uitextfield uialertview ios7 uialertviewdelegate

64
推荐指数
3
解决办法
4万
查看次数

在UIAlertView中添加UIActivityindicatorView

我想创建一个UIAlertView,它会说"......正在进行中".它还将显示UIActivityindicatorView就可以了.你能让我知道我该怎么办?

谢谢.

iphone

15
推荐指数
1
解决办法
1万
查看次数

警报视图在iOS7中显示白色矩形

以下代码在iOS 5到6.1中运行良好.我甚至在应用程序中存储了该代码:

-(void)showActivityIndicator
{
    if(!mLoadingView) //
    {
        mLoadingView = [[UIAlertView alloc] initWithTitle:@"" message:@"" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
        mLoadingView.tag = kAlertViewTag;
    }

    [mLoadingView show];
}

- (void)willPresentAlertView:(UIAlertView *)alertView
{
    if (alertView.tag == kAlertViewTag)
    {
        UIActivityIndicatorView *actInd = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
        actInd.frame = CGRectMake(128.0f, 45.0f, 25.0f, 25.0f);
        [alertView addSubview:actInd];
        [actInd startAnimating];

        UILabel *l = [[UILabel alloc]init];
        l.text = NSLocalizedString(@"PRODUCT_PURCHASE_INDICATOR_TITLE", @"Please wait...");
        l.font = [UIFont fontWithName:@"Helvetica" size:16];

        float strWidth = [l.text sizeWithFont:l.font].width;
        float frameWidth = alertView.frame.size.width;
        l.frame = CGRectMake((frameWidth - strWidth)/2, -25, 210, 100); …
Run Code Online (Sandbox Code Playgroud)

ios ios7

15
推荐指数
3
解决办法
1万
查看次数

是否可以在UIAlertView上垂直布置2个按钮?

我想用两个按钮创建UIAlertView.我需要垂直布置这些按钮(我的文字太大了).可能吗 ?

屏蔽1

在此输入图像描述

画面2

在此输入图像描述

uialertview ios

5
推荐指数
2
解决办法
1万
查看次数