[英]Cant click on button in UIAlertView after adding UIImageview to subView
確定按鈕不起作用。 我知道這是因為我添加了backgroundImageView。 我該如何運作?
這是我的代碼:
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"clock"]];
backgroundImageView.frame = CGRectMake(0, 0, 282, 200);
backgroundImageView.contentMode = UIViewContentModeScaleToFill;
backgroundImageView.userInteractionEnabled = YES;
[alert addSubview:backgroundImageView];
[alert sendSubviewToBack:backgroundImageView];
[alert show];
不幸的是,Apple不允許您添加子視圖或修改視圖層次結構。 請參閱https://developer.apple.com/library/ios/documentation/uikit/reference/UIAlertView_Class/UIAlertView/UIAlertView.html,以了解:
UIAlertView類旨在按原樣使用,並且不支持子類化。 此類的視圖層次結構是私有的,不能修改。
警報視圖的外觀
您無法自定義警報視圖的外觀。
違反這些規定將使您的應用程序在Apple Review流程中被拒絕-因此,我將回頭研究您的應用程序設計。
Apple不允許您將子視圖添加到UIAlertView
。 不能對UIAlertView
進行子類化,也不希望此類被子類化,這樣做可能是應用程序拒絕的原因。
您可以從此處使用庫來自定義UIAlertView
不要將子視圖添加到UIAlertView
,這是不受支持的功能。 如果您需要創建自定義視圖,請找到支持您所需內容的第三部分警報視圖解決方案,而改用它。
Apple不建議將子視圖添加到UIAlertView
您將必須創建自己的警報視圖。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.