iphone

Date formatter for a certain format of date

你离开我真会死。 提交于 2021-02-08 07:33:51
问题 I might missing something, but I can't compose proper date formatter string for the date: 2016-01-14T10:24:26+0000 What is 'T' here? and how to include timezone? My string does not work: @"yyyy-MM-dd'T'hh:mm:ss Z" 回答1: You have to use 'T' in single quotes like below format to retrive string ftom date: yyyy-MM-dd'T'hh:mm:ssZ Let me know. 回答2: NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init]; dateFormatter.dateFormat = @"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"; NSDate *yourDate =

UITextView UITextViewTextDidChangeNotification not being called on programmatic change of the text

五迷三道 提交于 2021-02-08 03:38:30
问题 I call this in the init of a custom UITextView: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:UITextViewTextDidChangeNotification object:self]; The method textChanged is not called when I programmatically set textView.text = @"" Any Ideas on what I am doing wrong? 回答1: Your shouldn't pass self to the last parameter, this parameter is notificationSender, it means that you just want to observer the notifications sent by self . Observer like this: [

How to convert shapefile to tile based file

十年热恋 提交于 2021-02-08 03:24:48
问题 I am developing a Map based iPhone application where I have to draw a map of any specific region depending upon the current location of that device. Client is supplying me the .shapefile consisting of all the co-ordinates and data to draw the map. We can store the shape file on the server and i think to draw the map on device with the data presented on .shapefile I need the tiles with different zoom level. So on the server side I have to convert the .shapefile into tile based file. But I don

React Native in VS Code: add configuration for iOS Device to launch.json

霸气de小男生 提交于 2021-02-08 03:05:27
问题 I have a React Native project open in Visual Studio code, and Im trying to run the project on a physical connected iOS device. I successfully ran the app on the device directly from Xcode, but from Visual Studio Code I'm having issues. I believe I need to add a configuration for the device into launch.json. I have tried different entries in there but non seem to work. What is the proper way to add a configuration for a connected iOS device? 回答1: Try with react-native run-ios --device "your

How to detect unsecured wifi network from iOS App

谁说我不能喝 提交于 2021-02-07 20:42:01
问题 I would like to detect the presence of unsecured wifi network in my app. Is there any public iOS API available to achieve the same? 回答1: There is no documented API to get that information. If you application needs to send and receive sensitive data across the network, you should generally assume that no connection is secured. 回答2: I would suggest you use an SSL connection for your web service. Then the data that leaves will be encrypted. 回答3: Have a look at the stumbler application and in

How to detect unsecured wifi network from iOS App

强颜欢笑 提交于 2021-02-07 20:40:18
问题 I would like to detect the presence of unsecured wifi network in my app. Is there any public iOS API available to achieve the same? 回答1: There is no documented API to get that information. If you application needs to send and receive sensitive data across the network, you should generally assume that no connection is secured. 回答2: I would suggest you use an SSL connection for your web service. Then the data that leaves will be encrypted. 回答3: Have a look at the stumbler application and in

UIScrollView callbacks while animating internally

给你一囗甜甜゛ 提交于 2021-02-07 20:32:20
问题 I have UIScrollView with one child that is zoomed (returned in viewForZoomingInScrollView:scrollView) and a number of other children which annotate the zoomed view and should always be positioned on top of the zoomed view at relative coordinates UIScrollView - zoomChild (size 100x100 at scale 1) - Annotate Child (size 10x10), always placed at relative position (0.2, 0.2) of zoomChild's frame I've subclassed UIScrollView and overridden scrollViewDidZoom:. I position an annotation child like -

Increasing Length of NSData

强颜欢笑 提交于 2021-02-07 19:54:46
问题 Basically, I have an NSString of 46 characters which i convert to NSData. I need to pad the string to 48 characters. It does not work via just adding ' ' to the end of the NSString. So, i just increased the length of NSData using this: NSString *string = @"__46characterlongstring__"; NSData *d = [string dataUsingEncoding:NSUTF8StringEncoding]; NSLog(@"d: %@", d); NSData *data = [NSData dataWithBytes:[d bytes] length:48]; NSLog(@"data: %@", data); The NSData called 'd' returns <723d6c67

How to Set repeat interval as well as fire date in UNNotificationRequest

。_饼干妹妹 提交于 2021-02-07 18:01:18
问题 Previously I am using UILocalNotification for reminder purpose in my application. But as above API is deprecated in iOS 10.0 now need to use UserNotifications Framework's UNNotificationRequest . Using UILocalNotification i was able to set fire date as well as repeat interval as below: UILocalNotification *localNotification = [[UILocalNotification alloc] init]; NSDate *tomorrow = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:[NSDate date]]; localNotification.fireDate = tomorrow; if

How to Set repeat interval as well as fire date in UNNotificationRequest

自作多情 提交于 2021-02-07 18:00:25
问题 Previously I am using UILocalNotification for reminder purpose in my application. But as above API is deprecated in iOS 10.0 now need to use UserNotifications Framework's UNNotificationRequest . Using UILocalNotification i was able to set fire date as well as repeat interval as below: UILocalNotification *localNotification = [[UILocalNotification alloc] init]; NSDate *tomorrow = [NSDate dateWithTimeInterval:(24*60*60) sinceDate:[NSDate date]]; localNotification.fireDate = tomorrow; if