[Solved] Swift 2 get the number of images in main bundle [closed]

Try this EDITED let myArray = NSMutableArray() var image:UIImage! var nimages = 0 for(;;nimages++){ let nameOfImg_ = entity.attribute let imageName = String(format: “name%@number%lu.jpg”, arguments: [nameOfImg_,(nimages + 1)]) if((NSBundle.mainBundle().pathForResource(imageName, ofType: nil)) != nil){ image = UIImage(contentsOfFile: NSBundle.mainBundle().pathForResource(imageName, ofType: nil)!) myArray.addObject(image!) }else{ break } } entity.attribute must be a String 12 solved Swift 2 get the number … Read more

[Solved] how to fetch user facebook friends names,count and id in app? [closed]

You’ll only be able to get the friends which also use your app, and you’ll need the user_friends permission for that. Please read the docs first: https://developers.facebook.com/docs/apps/changelog#v2_0_login https://developers.facebook.com/docs/graph-api/reference/user/friends Quotes: Friend list is no longer part of the default permission set and has its own permission: Asking for access to a person’s friend list is now … Read more

[Solved] Fresh init React Native Build has CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler error on Xcode 12

Actually, this question is for earlier builds of Xcode version 12, and this issue is disappeared in version 13.x I doubt anyone use version 12, but for fixing on Xcode 12, running and debugging on physical device could be a valid solution. solved Fresh init React Native Build has CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler error on … Read more

[Solved] How to call take picture method in IOS [closed]

You’ll want to take a look at the UIImagePickerController class which is what lets you access the camera functions of your iOS device. Specifically, you’ll want to use the source type UIImagePickerControllerSourceTypeCamera (first checking if the device has a camera via isSourceTypeAvailable:), with media type kUTTypeImage, present the camera controller via presentViewController, and you can … Read more

[Solved] Im getting an error at cellForRowAt and im not sure why

cell.textLabel?.text can only show a String object, not other objects. It will be product.item or product.price or product.salesPrice or all in one line. (based on your requirement). Make sure the value of product is not nil. cell.textLabel?.text = “\(product.item) \(product.price) \(product.salesPrice)” The full code you can try this: class ViewController: UIViewController, UIAdaptivePresentationControllerDelegate { @IBOutlet weak … Read more

[Solved] Cannot Assign Value of type ‘UIImage?’ to type ‘[UIImage]’ when generating a random image

To get a random image from your QuoteImages array you have to first get a random value and then request that from your array let randomValue = arc4random_uniform(10)+1 let randomImage = QuoteImages[randomValue] solved Cannot Assign Value of type ‘UIImage?’ to type ‘[UIImage]’ when generating a random image

[Solved] Fetch Image from URL

just i did getting image and display in navigation bar. Its working code. NSURL *urlNav = [NSURL URLWithString:@”https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png”]; NSData *urlData = [NSData dataWithContentsOfURL:urlNav]; UIImage *imageNav = [UIImage imageWithData:urlData]; UINavigationController *navController=[[UINavigationController alloc]initWithRootViewController:NextView]; //navController.navigationBarHidden=YES; [self.navigationController.navigationBar setBackgroundImage:imageNav forBarMetrics:UIBarMetricsDefault]; 0 solved Fetch Image from URL

[Solved] Dismiss keyboard after a user entered 11 digit [duplicate]

This is how it works func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { // YOU SHOULD FIRST CHECK FOR THE BACKSPACE. IF BACKSPACE IS PRESSED ALLOW IT if string == “” { return true } if let characterCount = textField.text?.count { // CHECK FOR CHARACTER COUNT IN TEXT FIELD if … Read more

[Solved] For loop runs forever

In your loop i will always be 1. You are using i + 1 for incrementing the counter variable but you are not assigning the value back. So either you use: for var i = 1; i < 10; i = i + 1 { println(i) } or for var i = 1; i < … Read more

[Solved] Change app icon every day [duplicate]

You can not change the Icons on your normal Apps on iOS, but you can change them between updates. You can change the icons of Newsstand Apps (i.e. magazine Apps inside the Newsstand), if you are making such an App. solved Change app icon every day [duplicate]

[Solved] Present a viewcontroller in UIView [closed]

To add a view controller to another view controller, you can do the following: Inside the parent view controller class: addChildViewController(someViewController) view.addSubview(someViewController.view) someViewController.didMove(toParentViewController: self) someViewController.view.translatesAutoresizingMaskIntoConstraints = false Then, set the layout constraints to position the view controller: NSLayoutConstraint.activate([ someViewController.view.leadingAnchor .constraint(equalTo: view.leadingAnchor ), someViewController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), someViewController.view.bottomAnchor .constraint(equalTo: view.bottomAnchor ), someViewController.view.topAnchor .constraint(equalTo: view.topAnchor ) ]) view.layoutIfNeeded() 2 … Read more