Objective c 自定义UIAlertView:CODialog显示在左上角
我使用自定义UIAlertView,它可以工作(意味着它会弹出),但我的问题是它不会在屏幕中央弹出,弹出后按钮就不起作用了。我在示例文件中实现了它,但似乎没有发现问题 我在我的项目中添加了“CODialog.h”和“CODialog.m”。然后做了以下工作: ViewController.h文件:Objective c 自定义UIAlertView:CODialog显示在左上角,objective-c,ios5,ios6,uialertview,custom-view,Objective C,Ios5,Ios6,Uialertview,Custom View,我使用自定义UIAlertView,它可以工作(意味着它会弹出),但我的问题是它不会在屏幕中央弹出,弹出后按钮就不起作用了。我在示例文件中实现了它,但似乎没有发现问题 我在我的项目中添加了“CODialog.h”和“CODialog.m”。然后做了以下工作: ViewController.h文件: #import "CODialog.h" 另一个方法正在调用showDefault。我的目标是iOS5-iOS6,并使用带有ARC的故事板。有什么想法吗?您尝试过将该视图的.center属性设
#import "CODialog.h"
另一个方法正在调用showDefault。我的目标是iOS5-iOS6,并使用带有ARC的故事板。有什么想法吗?您尝试过将该视图的.center属性设置为父视图的一半大小吗?您尝试过将该视图的.center属性设置为父视图的一半大小吗?如何: self.dialog=[CODialog dialogWithWindow:self.navigationController.view.window] 它可以解决问题。那么: self.dialog=[CODialog dialogWithWindow:self.navigationController.view.window]
它会解决问题。不,我没有试过,但我最终使用了它。它很容易实现,而且一开始就没有问题。包括非常可自定义的.png图像。谢谢,无论如何我都会试试。不,我没有试过,但我最终还是用了。它很容易实现,而且一开始就没有问题。包括非常可自定义的.png图像。谢谢,不过我还是要试试。
@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];
}