随笔分类 -  Swift

Apple's new programming language~
摘要:let manager = AFHTTPRequestOperationManager() let url = "http://api.openweathermap.org/data/2.5/weather" let params = ["lat":latitude, "lon":... 阅读全文

posted @ 2014-09-30 20:53 SCaptain 阅读(2099) 评论(0) 推荐(0)

摘要:1、获取locationManagerlet locationManager: CLLocationManager = CLLocationManager()2、设置locationManager的精度locationManager.desiredAccuracy = kCLLocationAccu... 阅读全文

posted @ 2014-09-30 20:37 SCaptain 阅读(240) 评论(0) 推荐(0)

摘要:是在万能的stackOverflow上找到的答案,留下了,原地址:http://stackoverflow.com/questions/6496441/creating-a-uiimage-from-a-uicolor-to-use-as-a-background-image-for-uibut... 阅读全文

posted @ 2014-09-16 16:41 SCaptain 阅读(1370) 评论(0) 推荐(0)

摘要:网上的一些方法在我这行不通,比如:UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent1、Set the UIViewControllerBasedStatusBarAppearance to... 阅读全文

posted @ 2014-09-16 16:02 SCaptain 阅读(2982) 评论(1) 推荐(0)

摘要:TableView这个控件在iOS的开发中非常的常见,他可以较好的展示一个层级结构。这里主要介绍,在点击某个条目的时候,如何进行跳转的下一个界面。以下是官方的关于这个跳转如何去实现,和如何去传递数据的过程。 Storyboards make it easy to pass data from ... 阅读全文

posted @ 2014-09-11 14:38 SCaptain 阅读(1618) 评论(0) 推荐(0)

摘要:button.layer.cornerRadius = 10 // 这个值根据你想要的效果可以更改button.clipsToBounds = true这种方法不止可以设置按钮,UIView应该都可以设置,ImageView我试过ok,其他的UIKit用到了再试 阅读全文

posted @ 2014-09-03 15:27 SCaptain 阅读(471) 评论(0) 推荐(0)

摘要:导入AudioToolbox.framework包在swift文件中import AudioToolboxAudioServicesPlaySystemSound(SystemSoundID.convertFromIntegerLiteral(UInt32(kSystemSoundID_Vibrat... 阅读全文

posted @ 2014-09-02 14:55 SCaptain 阅读(527) 评论(0) 推荐(0)

摘要:在iOS7系统的Mail App中TableViewCell的一个功能让我们做TableView的比较羡慕,就是滑动cell,右边出现了两个按钮,如下:网上在github上有很多大牛用custom tableViewCell的方法实现了这个效果,甚至更强,比如这两位:https://github.c... 阅读全文

posted @ 2014-09-01 21:55 SCaptain 阅读(1547) 评论(0) 推荐(0)

摘要:今天在看官方的TableView Guide,突然想起来最近写的一个代码中实现tableViewCell复用的时候有点问题:var cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: identi... 阅读全文

posted @ 2014-09-01 10:31 SCaptain 阅读(1059) 评论(0) 推荐(0)

摘要:var date = NSDate.date() var timeFormatter = NSDateFormatter()timeFormatter.dateFormat = "MM-dd 'at' HH:mm:ss.SSS"var time = timeFormatter.stri... 阅读全文

posted @ 2014-08-29 13:16 SCaptain 阅读(736) 评论(0) 推荐(0)

摘要:今天App写到了蓝牙重连的阶段,以前针对sdk 6.0写的代码,蓝牙设备的回复是通过- (void)retrievePeripherals:(NSArray *)peripheralUUIDs然后回调 centralManager:didRetrievePeripherals:函数来得到可以回复... 阅读全文

posted @ 2014-08-28 19:02 SCaptain 阅读(3266) 评论(0) 推荐(0)

摘要:偷个懒,看到了个比较靠谱的答案,直接复制过来了。原网址:http://stackoverflow.com/questions/24024549/dispatch-once-singleton-model-in-swiftFrom my short experience with Swift ther... 阅读全文

posted @ 2014-08-19 15:55 SCaptain 阅读(1012) 评论(0) 推荐(1)

摘要:看过一些蓝牙App的事例,大体上对蓝牙的连接过程进行了了解。但是开始真正自己写一个小的BLE程序的时候就举步维艰了。那些模棱两可的概念在头脑中瞬间就蒸发了,所以还是决定从最基本的蓝牙连接过程进行。这里所说的蓝牙是针对 bluetooth 4.0的。 第一步就是去看官方的关于蓝牙框架的文档,即C... 阅读全文

posted @ 2014-08-18 20:39 SCaptain 阅读(11008) 评论(4) 推荐(1)

摘要:Except that on android you can bypass the pairing dialog if you know the PIN in advance through a different channel.EtanOn 06.02.2013, at 10:09, "Andr... 阅读全文

posted @ 2014-08-18 18:35 SCaptain 阅读(490) 评论(0) 推荐(0)

摘要:在oc中我们通过-(CardMatchingGame *)game{ if(!_game) _game=[[CardMatchingGame alloc] initWithCardCount:[self.cardButtons count] usingDeck:[self createDeck... 阅读全文

posted @ 2014-07-29 12:08 SCaptain 阅读(855) 评论(0) 推荐(0)

摘要:当你在使用Swift时会发现一些常用的函数不!见!了!比如String: s.count() s.contains()Array: a.indexOfObeject(t:)我看网上有人说用extension Array的方法调用NSArray的indexOfObject来实现extension A... 阅读全文

posted @ 2014-07-16 22:19 SCaptain 阅读(701) 评论(1) 推荐(0)

摘要: 这两天在学习Stanford出品的iOS7的课程,这个课程去年也看过,但是看到第3课就不行了,满篇的OC,把人都搞晕了。这段时间因为要写个iOS的App,正好赶上了Swift问世,所以趁着这股劲继续学习iOS的开发,把网上的一些视频关于Swift的都看过和做过了,然后选择看Stanford出品... 阅读全文

posted @ 2014-07-16 20:22 SCaptain 阅读(2130) 评论(0) 推荐(0)

导航