小编Mar*_*nop的帖子

UIAlertController获取文本

我试图从UIAlertController文本字段中获取文本.有人可以告诉我,由于它不起作用,我做错了什么.我得到一个NIL回归.

- (IBAction)btnMakeRec {

        UIAlertController *alert= [UIAlertController
                                   alertControllerWithTitle:@"Recipe Name?"
                                   message:@""
                                   preferredStyle:UIAlertControllerStyleAlert];

        UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
                                                   handler:^(UIAlertAction * action){


                                               UITextField *temp = alert.textFields.firstObject;

                                               RecipeDesc.text = temp.text;
                                               // HERE temp is Nil


                                               RDescription = [[NSString alloc ] initWithFormat:@"%@", RecipeDesc.text];


                                                   }];

        UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault
                                                       handler:^(UIAlertAction * action) {

                                                         //  NSLog(@"cancel btn");

                                                           [alert dismissViewControllerAnimated:YES completion:nil];

                                                       }];

        [alert addAction:ok];
        [alert addAction:cancel];

        [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
            textField.placeholder = @"Enter the name of the recipe";
            textField.keyboardType = UIKeyboardTypeDefault;
        }];

        [self presentViewController:alert animated:YES …
Run Code Online (Sandbox Code Playgroud)

xcode6 ios8 uialertcontroller

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

警告:所有应用程序都应包含armv7架构(当前archs ="arm64")

警告:所有应用程序都应包含armv7架构(当前archs ="arm64").

我已经阅读了早期版本的XCode的其他帖子,这些例子都没有帮助解决这个问题.它似乎无论我在设置中放置什么,如下所示,都有帮助.我仍然得到同样的错误.

项目和目标设置看起来相同.我试过添加armv7s,但没有帮助.

我不知道为什么错误说当前的archs - arm64.它没有看到其他一切吗?

项目和目标的设置

xcode6 ios8

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

Android毫秒时间

我已经阅读了所有的文档,似乎没有太多的东西可以真正解释日期函数,或者缺少日期函数.

我正在尝试实现AlarmManger,它需要触发器以毫秒(ms)为单位的时间.为了测试,我花了当前时间并增加了5秒,这很好.

// get a Calendar object with current time
 Calendar cal = Calendar.getInstance();
 // add 5 minutes to the calendar object
 cal.add(Calendar.SECOND, 5);
Run Code Online (Sandbox Code Playgroud)

如果我有一个日期和时间,我将如何获得那段时间的ms.

喜欢"3/2/2011 08:15:00"

如何将其转换为毫秒?

android calendar milliseconds alarmmanager

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

我应该将我的Android应用程序移植到iPhone吗?

我已经为Android开发了一个应用程序,它运行良好,最后,感谢StackOverflow的所有帮助!!

现在我被要求让它在iPhone上运行.我刚才看了一下iPhone,但不是最近.

每个人都在想什么?我是否应该花时间学习Objective C和iPhone并移植应用程序或忘记它?

是否有任何交叉引用功能的书籍,以便您可以在iPhone上查找如何在Android上执行某些操作?

iphone android

4
推荐指数
1
解决办法
3816
查看次数

iphone模态视图 - 如何返回父父控制器

我有几个观点,我一个接一个地打开模态.View1调用View2,View2调用View3.
我使用此代码调用下一个视图:

   View2 *myView = [[View2 alloc] initWithNibName:@"View2" bundle:[NSBundle mainBundle]];   

    [self presentModalViewController:myView animated:YES];

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

如果用户按下取消,则返回一个View ... 3到2和2到1

[self.parentViewController dismissModalViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)

我需要做的是当用户在View3上时,如果他们没有选择取消但是完成操作,那么我需要返回View1并释放View2和View3.

我怎么做?

编辑:MAIN WINDOW有一个Navcontroller和6个视图控制器.我将View 1称为:

View1 *screen = [[View1 alloc] initWithNibName:@"View1" bundle:[NSBundle mainBundle]];
    self.Search = screen;

    [mainNavController presentModalViewController:screen animated:YES];

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

编辑#2:主要Windows调用视图1.主窗口在XIB中有一个NavController,它可以工作:

    View1 *screen = [[View1 alloc] initWithNibName:@"View1" bundle:[NSBundle mainBundle]];


[mainNavController presentModalViewController:screen animated:YES];

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

然后在View 1的XIB中,我添加了一个NavController并将其绑定到.h中的View1NavController

视图1然后调用视图2:

   View2 *myView = [[[View2 alloc] initWithNibName:@"View2" bundle:nil] autorelease];

UINavigationController * navController = [[[UINavigationController alloc] initWithRootViewController:myView] autorelease]; 

[View1NavController presentModalViewController:navController animated:YES];
Run Code Online (Sandbox Code Playgroud)

当我执行此操作时,没有错误,但它没有显示View2.

iphone modal-dialog modalviewcontroller

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

UIActionSheet - 类没有实现'UIActionSheetDelegate'协议

我试图用日期选择器了解UiActionSheet.

得到2个我似乎无法清除的警告,请参阅代码部分末尾的代码.

警告:语义问题:将'DeveloperTL*'发送到不兼容类型'id'的参数

警告:语义问题:将'DeveloperTL*'发送到不兼容类型'id'的参数

任何想法如何解决这些警告?

我从其他几个例子中复制的代码:

    define kPickerTag 200
    define SelectButtonIndex 1
    define CancelButtonIndex 2
    NSString *strPrintDate;


    - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
        if (buttonIndex != [actionSheet cancelButtonIndex]) {

            //set Date formatter
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"MM/dd/YYYY h:mm a"];

            //Gets our picker
            UIDatePicker *ourDatePicker = (UIDatePicker *) [actionSheet viewWithTag:kPickerTag];

            NSDate *selectedDate = [ourDatePicker date];

            NSString *msg = [[NSString alloc] initWithFormat:@"The date that you had selected was, %@", [formatter stringFromDate:selectedDate]];
            [formatter release];

            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Date" …
Run Code Online (Sandbox Code Playgroud)

iphone uidatepicker uiactionsheet

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

MFMailComposeViewController是否应该从模拟器实际发送邮件?

我正在使用MFMailComposeViewController,一切似乎都很好.该类表示邮件已发送,但我从未在模拟器上设置电子邮件而且不知道如何.所以,如果它被发送,它发送了什么电子邮件服务器?

[mailClass canSendMail]也返回YES,所以它认为一切正常.

有谁知道如何设置模拟器来测试这100%

email iphone

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

NSAppleMusicUsageDescription-缺少Info.plist键

我添加了电子邮件建议的密钥,还添加了下拉列表中的密钥。

我清理了项目。我不知所措。

这是来自Apple的电子邮件:

缺少Info.plist键-此应用尝试访问对隐私敏感的数据,而没有使用说明。该应用程序的Info.plist必须包含一个NSAppleMusicUsageDescription键,该键具有字符串值,向用户解释该应用程序如何使用此数据。

在此处输入图片说明

在此处输入图片说明

objective-c ios xcode8

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

console.log 在 chrome.runtime.onMessage.addListener 中不起作用

谷歌浏览器扩展。console.log 在 addListener 中不起作用,但在 addListener 之外工作正常。我已经重新安装了。我已经在 Windows 和 MacOS 上尝试过了。

chrome.runtime.onMessage.addListener(

 function(request, sender, sendResponse) {

    console.log("listen"); // this does not
    alert("got here"); // this works


 }
);
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome-extension

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

willPresentActionSheet在一个类中有两个不同的动作表.如何知道哪一个会出现

在我的课堂上,我需要有2个不同的(或更多)动作表.所有工作表都转到willPresentActionSheet.在willPresentActionSheet中,我会添加一个datepicker.但是我怎么知道哪个动作表叫做willPresentActionSheet?

编辑:我创建了这样的动作表:

UIActionSheet *asheet = [[UIActionSheet alloc] 
                         initWithTitle:@"Pick a value" 


                         delegate:self
                         cancelButtonTitle:@"Cancel" 
                         destructiveButtonTitle:nil 
                         otherButtonTitles:@"Select"
                         , nil];

[asheet showInView:[self.view superview]]; 

[asheet setFrame:CGRectMake(0, 117, 320, 383)];
[asheet release];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uiactionsheet ios

0
推荐指数
1
解决办法
750
查看次数