Can’t find momd file: Core Data problems

Here are a few recommendations: The code you posted to get the .mom(d) file is not exactly the recommended way. Use mergedModelFromBundles instead, as in self.managedObjectContent= [NSManagedObjectModel mergedModelFromBundles:nil]; It takes care of getting the path, choosing/merging the correct mom or momd, and initializing of the MOC all by one step. You should use this. But … Read more

Embed a UIViewController in a NavigationController using segues

In your Storyboard, you can embed a ViewController in a Navigation Controller by selecting the View Controller and then picking from the menu at the top Editor->Embed In->Navigation Controller. From another view controller, you control drag to this Navigation controller to set up the modal segue. You can also control drag to the original View … Read more

Upload image to the PHP server from iOS

You can upload image from iOS App to PHP server like this two way: Using New AFNetworking : #import “AFHTTPRequestOperation.h” #import “AFHTTPRequestOperationManager.h” NSString *stringUrl =@”http://www.myserverurl.com/file/uloaddetails.php?” NSString *string =@”http://myimageurkstrn.com/img/myimage.png” NSURL *filePath = [NSURL fileURLWithPath:string]; NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:userid,@”id”,String_FullName,@”fname”,String_Email,@”emailid”,String_City,@”city”,String_Country,@”country”,String_City,@”state”,String_TextView,@”bio”, nil]; AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager POST:stringUrl parameters:parameters constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { [formData appendPartWithFileURL:filePath name:@”userfile” error:nil];//here userfile … Read more

Get the frame of UIBarButtonItem in Swift?

You should try it like: var barButtonItem = self.navigationItem.rightBarButtonItem! var buttonItemView = barButtonItem.valueForKey(“view”) var buttonItemSize = buttonItemView?.size Edit (Swift 3): var barButtonItem = self.navigationItem.rightBarButtonItem! let buttonItemView = barButtonItem.value(forKey: “view”) as? UIView var buttonItemSize = buttonItemView?.size

google maps iOS SDK: custom icons to be used as markers

Here is what I have done let marker = GMSMarker() // I have taken a pin image which is a custom image let markerImage = UIImage(named: “mapMarker”)!.withRenderingMode(.alwaysTemplate) //creating a marker view let markerView = UIImageView(image: markerImage) //changing the tint color of the image markerView.tintColor = UIColor.red marker.position = CLLocationCoordinate2D(latitude: 28.7041, longitude: 77.1025) marker.iconView = markerView … Read more

How to edit UIAlertAction text font size and color

You can update text color using UIAlertAction *myGoalAction = [UIAlertAction actionWithTitle:NSLocalizedString(@”My Title”, @”My Title”) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { }]; [myGoalAction setValue:[UIColor greenColor] forKey:@”titleTextColor”]; There is no efficient way to update font size.I will suggest you to use standard font size. UIAlertAction title label is private variable and not accessible directly. Label comes inside 3 level … Read more

WKWebView function for detecting if the URL has changed

Swift Version // Add observer webView.addObserver(self, forKeyPath: “URL”, options: .new, context: nil) // Observe value override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { if let key = change?[NSKeyValueChangeKey.newKey] { print(“observeValue \(key)”) // url value } }