用swift编程语言隐藏文本字段的键盘

我在Objective-C方面没有什么经验。 我想用Swift编程语言来隐藏文本字段的键盘。 我也试过这个 func textFieldShouldReturn(textField: UITextField!) -> Bool // called when 'return' key pressed. return NO to ignore. { return true; } 但是当我打回来时,这个方法并没有被触发。 任何人都有这个运气?

将数据传递给Apple Watch应用程序

我试图从我的应用程序传入数据到我的Apple Watch应用程序。 基本上,我使用的方法与创build当前小部件的方法相同,所以我通过NSUserDefaults传递数据。 问题是,当我运行我的应用程序时,数据不会像我所期望的那样更新Watch应用程序中的标签。 这是我有… override init(context: AnyObject?) { // Initialize variables here. super.init(context: context) // Configure interface objects here. NSLog("%@ init", self) var defaults = NSUserDefaults(suiteName: "group.AffordIt") var totalBudgetCalculation = "" if (defaults!.stringForKey("totalBudgetWidget") != nil) { println("Worked") totalBudgetCalculation = defaults!.stringForKey("totalBudgetWidget")! initialBudgetLabel.setText("Initial: \(totalBudgetCalculation)") } var currentBudgetCalculation = "" if (defaults!.stringForKey("currentBudgetWidget") != nil) { currentBudgetCalculation = […]

以编程方式添加导航栏iOS

我正在尝试使用导航栏(后退button,标题等)和选项卡栏(底部的工具栏)制作应用程序。 我使用子视图,所以我不必担心状态栏,导航栏,标签栏高度等,但我认为这是我的麻烦,因为我似乎无法弄清楚如何设置导航栏和制表符栏。 这是我的。 我究竟做错了什么? AppDelegate.h (default for single view app) AppDelegate.m (default for single view app) ViewController.h #import <UIKit/UIKit.h> @interface ViewController : UIViewController @property (strong, nonatomic) UIView *contentSubview; @end ViewController.m #import "ViewController.h" @interface ViewController () @end @implementation ViewController – (void)loadView{} – (void)viewDidLoad { [super viewDidLoad]; UIView *view = [[UIView alloc] init]; view.backgroundColor = [UIColor greenColor]; […]

本周开始和结束date

我想获得当前的一周的开始和结束date,我也想使用当前月份的开始和结束date以及下周的开始和结束date。 提前致谢。

枚举我的iOS应用程序中的所有钥匙串项目

什么是最简单的方式(从我的应用程序)获取存储在钥匙串中的所有项目? 它可能与SecItemCopyMatching()有关,但该函数的文档不是很清楚(我没有find一个体面的样本在网上)。

以编程方式打开UITableView编辑操作button

我有一个UIPageViewController里面有UITableViewControllers ,并且滑动左手势在UIPageViewController之间改变视图和UITableViewCells手势来打开编辑操作之间冲突,所以我需要显示编辑操作,当某个button被点击细胞。 我的问题是我可以通过编程方式显示编辑操作button,而不是在滑动手势上显示它们吗?

使用UIImagePickerController“创build未知types的图像格式是一个错误”

在iOS 10中从图像select器中select图像时Swift 3我得到一个错误 – Creating an image format with an unknown type is an error func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) { imagePost.image = image self.dismiss(animated: true, completion: nil) } 图像没有被选中和更新。 我需要帮助或build议,以了解是否在iOS10或Swift 3中更改了此方法的语法或任何其他方法。

iPhone:每日本地通知

我正在尝试实施本地通知 这是我设定的 // Current date NSDate *date = [NSDate date]; // Add one minute to the current time NSDate *dateToFire = [date dateByAddingTimeInterval:20]; // Set the fire date/time [localNotification setFireDate:dateToFire]; [localNotification setTimeZone:[NSTimeZone defaultTimeZone]]; 而不是20,我想把一个固定的时间(每天)开始推。 例如:我想推动通知每6:00上午popup。 怎么可能呢? 谢谢

如何获得位置用户的CLLocationManager在迅速?

我有我的视图控制器上的这段代码,但这不工作: import UIKit import CoreLocation class ViewController: UIViewController, CLLocationManagerDelegate { var location: CLLocationManager! override func viewDidLoad() { super.viewDidLoad() location=CLLocationManager() location.delegate = self location.desiredAccuracy=kCLLocationAccuracyBest location.startUpdatingLocation() } func locationManager(location:CLLocationManager, didUpdateLocations locations:AnyObject[]) { println("locations = \(locations)") label1.text = "success" } 我有我阅读其他职位的权限。 但我从来没有获得,没有println .. 谢谢!!

如何构build和编译PJSIP for Xcode,使用示例代码IPJSUA来testing?

如何使用xCode构build和编译PJSIP并运行示例代码IPJSUA?