[Solved] memory leak when calling an Api [closed]

You should refresh your memory (no pun intended) what a memory leak is. No, having thousands of entries in memory does not necessarily lead to memory leak (the main source of memory leaks in Swift are closures). It could, however, increase the memory pressure – which means your app could run out of free memory … Read more

[Solved] Insert few objects from an array in nsmutable dictionary

You are using the SAME TAG “Images” for every number you set. Hence it gets replaced again and again dic=[[NSMutableDictionary alloc]init]; for (m = 0; m < 20; m++) { rnd = arc4random_uniform(FrontsCards.count); [dic setObject:[NSNumber numberWithInt:rnd] forKey:[NSString stringWithFormat:@”Images_%d”,rnd]; } NSLog(@”%@”,[dic description]); 0 solved Insert few objects from an array in nsmutable dictionary

[Solved] Swift 3 custom touch motion to trigger action [closed]

Well you question is divided into 2 parts and I’ll answer them both. 1- What you are looking for is UIGestureRecognizer where it’ll recognize a gesture and do an action accordingly. Here is a link taht will help you out! https://www.raywenderlich.com/76020/using-uigesturerecognizer-with-swift-tutorial 2- Unlocking the phone is impossible without jailbreak. Your gestures are bound to your … Read more

[Solved] How to get an string array from JSON arrays? [closed]

First of all you need to convert the raw response from the server to a Swift Dictionary. let payload = [ “cars”: [ [ “color”: “red”, “model”: “ferrari”, “othersAtributes”: “others atributes” ], [ “color”: “blue”, “model”: “honda”, “othersAtributes”: “others atributes” ], [ “color”: “green”, “model”: “ford”, “othersAtributes”: “others atributes” ], [ “color”: “yellow”, “model”: “porshe”, … Read more

[Solved] How to change JSON string to date format in tableview

In which format do you want to convert. Try this one with your desired format if let dateString = JSONList[indexPath.row].createdDate{ let dateFormatter = DateFormatter() dateFormatter.locale = Locale(identifier: “en_US_POSIX”) dateFormatter.dateFormat = “yyyy-MM-dd HH:mm:ss” dateFormatter.timeZone = TimeZone(secondsFromGMT: 0) let date = dateFormatter.date(from: dateString) dateFormatter.dateFormat = “dd/MM/yyyy” let dateStr = dateFormatter.string(from:date!) cell.Date.text = dateStr } 0 solved How … Read more

[Solved] trimmingCharacters not work on iOS 10.3 Xcode8.3

From the documentation: A new string made by removing from both ends of the receiver characters contained in set. It does not remove characters within the string. You can replace whitespaces – corresponding to the .whitespaces character set – in the string with regular expression: let _searchStr = searchStr.replacingOccurrences(of: “\\s”, with: “”, options: .regularExpression) solved … Read more

[Solved] Accessing Coordinates in Plist – iOS [closed]

NSMutableDictionary *root = [[NSMutableDictionary alloc] initWithContentsOfFile:path]; NSDictionary *routes = [root objectForKey: @”Routes”]; NSArray *cities = [routes allValues]; for (NSDictionary *city in cities) { NSArray *locations = [city allValues]; for (NSDictionary *loc in locations) { NSDictionary *coord = [loc objectForKey:@”coordinate”]; NSLog(@”%@”,[coord objectForKey:@”latitude”]); } } 3 solved Accessing Coordinates in Plist – iOS [closed]

[Solved] Text Editor Example for iPhone [closed]

Use UITextView for text editing. If you need rich text, you have to write something on your own – not currently available. Cocoanetics did start implementing rich text label at https://github.com/Cocoanetics/NSAttributedString-Additions-for-HTML and AFAIK he did want to create rich text editor too (at least I read this on Twitter). solved Text Editor Example for iPhone … Read more

[Solved] Alternate to IMEI

There are a few alternatives to the IMEI or MAC address that Apple now provide. One such is [[UIDevice currentDevice] identifierForVendor]. From Apple’s documentation. An alphanumeric string that uniquely identifies a device to the app’s vendor. The value of this property is the same for apps that come from the same vendor running on the … Read more

[Solved] Is there any way to making transition without storyboard?

I solve my problem. I just add that code for calling animation transition in my homecontroller: extension HomeController: UIViewControllerTransitioningDelegate { func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { return faceanim() } func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { return faceanim() } } And to button action is: @objc func handleAccount() { let … Read more

[Solved] How to get the values from nested JSON – Objective c

I have create JSON data through coding so don’t consider it just check the following answer /// Create dictionary from following code /// it just for input as like your code NSMutableDictionary * dict = [[NSMutableDictionary alloc] init]; NSMutableDictionary * innr = [[NSMutableDictionary alloc] init]; [innr setObject:@”red” forKey:@”Color”]; [innr setObject:@”01″ forKey:@”color_id”]; NSMutableDictionary * outer = … Read more

[Solved] custom tableviewcell and autolayout

You can definitely use any kind of UIView without using IB, this includes a UITableViewCell. What you could do is in your – (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier method, you can configure all the constraints, you can set every single subview that you want for your tableview to CGRectZero, and add them to the cell’s contentView, the … Read more