我使用CODialog爲我的自定義UIAlertView和它的工作原理(意味着彈出),但我的問題是它不會彈出在屏幕中心,彈出後按鈕不起作用。我在示例文件中實現了它,但似乎無法找到問題。自定義UIAlertView:CODialog顯示在左上角
我在項目中添加了「CODialog.h」&「CODialog.m」。然後做了以下內容:
ViewController.h文件:
#import "CODialog.h"
...
@property (nonatomic, strong) CODialog * dialog
...
@synthesize dialog;
- (void) viewDidLoad{
self.dialog = [CODialog dialogWithWindow:self.view.window];
}
- (void)showDefault:(id)sender {
[self.dialog resetLayout];
self.dialog.dialogStyle = CODialogStyleDefault;
self.dialog.title = @"Title";
self.dialog.subtitle = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
[self.dialog addButtonWithTitle:@"Done" target:self selector:@selector(hideDialog:)];
[self.dialog addButtonWithTitle:@"Ok" target:self selector:@selector(hideDialog:) highlighted:YES];
[self.dialog showOrUpdateAnimated:YES];
}
- (void)hideDialog:(id)sender {
[self.dialog hideAnimated:YES];
}
隨着showDefault被稱爲另一種方法。我的目標是iOS5 - iOS6和使用ARC的故事板。有任何想法嗎?
不,我沒有嘗試過,但我最終使用[TSAlertView](https://github.com/TomSwift/TSAlertView)代替。這很容易實施,沒有問題馬上解決。包括可定製的.png圖像。謝謝你,我會試試它。 – SReca