How do I URL encode a string

Unfortunately, stringByAddingPercentEscapesUsingEncoding doesn’t always work 100%. It encodes non-URL characters but leaves the reserved characters (like slash / and ampersand &) alone. Apparently this is a bug that Apple is aware of, but since they have not fixed it yet, I have been using this category to url-encode a string: @implementation NSString (NSString_Extended) – (NSString … Read more

How to get device make and model on iOS?

EITHER try this library: http://github.com/erica/uidevice-extension/ (by Erica Sadun). (The library is 7-8 years old, and hence is obsolete) (Sample Code): [[UIDevice currentDevice] platformType] // ex: UIDevice4GiPhone [[UIDevice currentDevice] platformString] // ex: @”iPhone 4G” OR You can use this method: You can get the device model number using uname from sys/utsname.h. For example: Objective-C #import <sys/utsname.h> … Read more

Populating information in swift 3 for iPad

You could implement UITextFieldDelegate and your delegate will be called when the user enter something in your text field. First set the delegate to self txtField.delegate = self Use this if you want to change the other fields when the user is done editiing your master field func textFieldDidEndEditing(_ textField: UITextField, reason: UITextFieldDidEndEditingReason) { // … Read more

How to show Image over Map not as Pin but as seperate image? [duplicate]

You are looking for Map Overlay MKOverlayView. Check these tutorials: Overlay View Image Overlay Creating overlay Creating a MKOverlayView Create a subclass of MKOverlayView like: .h #import #import @interface MapOverlayView : MKOverlayView { } @end .m #import “MapOverlayView.h” @implementation MapOverlayView – (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)ctx { UIImage *image = [UIImage imageNamed:@”yourImage.png”]; CGImageRef imageReference = image.CGImage; MKMapRect … Read more