小编Cal*_*one的帖子

UIAlertController - 向操作表添加自定义视图

当我们尝试在屏幕截图中附加图像时,我正在尝试制作在iOS上的消息应用中显示的操作表.

我意识到在新的UIAlertController中,我们无法适应任何自定义视图.我有什么方法可以做到这一点?

我的代码看起来很标准.

    let alertController = UIAlertController(title: "My AlertController", message: "tryna show some images here man", preferredStyle: UIAlertControllerStyle.ActionSheet)

        let okAction = UIAlertAction(title: "oks", style: .Default) { (action: UIAlertAction) -> Void in
        alertController.dismissViewControllerAnimated(true, completion: nil)
    }
    let cancelAction = UIAlertAction(title: "Screw it!", style: .Cancel) { (action: UIAlertAction) -> Void in
        alertController.dismissViewControllerAnimated(true, completion: nil)
    }

    alertController.addAction(okAction)
    alertController.addAction(cancelAction)

    self.presentViewController(alertController, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

swift uialertcontroller ios9

41
推荐指数
3
解决办法
6万
查看次数

将nil Dates排序到数组的末尾

尝试按降序对Swift中的数组进行排序.这很好用

objectArray.sort{ $0.date!.compare($1.date!) == .orderedDescending}
Run Code Online (Sandbox Code Playgroud)

如你所见,我强行解开约会.我正在寻找另一种方式,以便如果日期是nil,对象移动到数组的末尾.

sorting date optional swift

7
推荐指数
1
解决办法
1144
查看次数

多台电脑上的苹果开发者证书,一个单独的开发者账号

我可以为个人 Apple Dev 帐户设置 2 个单独的配置文件吗?

基本上我需要使用 2 台不同的笔记本电脑进行开发。如果不从我的第一台笔记本电脑 + 电子邮件中撤销已经存在的证书,我将无法生成新证书。我有办法解决这个问题吗?

ios provisioning-profile ios-provisioning

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

Objective-C检查self是否也是子类

这与目标C有关.我有3个班级. ClassA,ClassBClassC.

ClassB并且ClassC是.的子类ClassA.

@interface ClassB : ClassA
@interface ClassC : ClassA
Run Code Online (Sandbox Code Playgroud)

我需要做的检查classA,不论是否selfClassBClassC.

inheritance objective-c

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

Noob属性错误

我正在使用现有代码.这里有一个popovercontroller已在.h文件中声明,它在实现行中给出了错误.

.h文件

@property (nonatomic, strong)   VFImagePickerController     *imagePicker;
@property (nonatomic, strong)   UIPopoverController         *popoverController;
@property (nonatomic, strong)   UINavigationController      *targetVC;
Run Code Online (Sandbox Code Playgroud)

.m文件:
错误

请建议如何解决这个问题.

properties objective-c uipopovercontroller

4
推荐指数
2
解决办法
1083
查看次数

在ipad上的动作表

此代码在iPhone上运行良好,但在iPad上,操作表显示在屏幕中间.不在触发按钮所在的角落.此外,没有取消按钮显示.

此外,该应用程序仅处于横向模式.相机触发按钮位于屏幕的右上角.

mediaPicker = [[UIImagePickerController alloc] init];
mediaPicker.allowsEditing = YES;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                             delegate:self
                                                    cancelButtonTitle:@"Cancel"
                                               destructiveButtonTitle:nil
                                                    otherButtonTitles:@"Take photo", @"Choose Existing", nil];
    //[actionSheet showInView:self.view];
    [actionSheet showInView:self.navigationController.view];
}
// If device doesn't has a camera, Only "Choose Existing" and "Cancel" options will show up.
else {
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                             delegate:self
                                                    cancelButtonTitle:@"Cancel"
                                               destructiveButtonTitle:nil
                                                    otherButtonTitles:@"Choose Existing", nil];
    [actionSheet showInView:self.view];
}
Run Code Online (Sandbox Code Playgroud)

我需要动作表来显示按钮的位置.我应该怎么做呢.

alignment uiactionsheet ipad ios

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