[Solved] Regarding retain count [closed]

Retain counts are pretty much useless, see http://whentouseretaincounts.com for details of why. However, I added calls to retainCount to your code and ran the following: NSArray *arr = [[NSArray arrayWithObjects:@”ag”, @”sdfg”, @”dgh”, nil] retain]; NSLog(@”%ld”, [arr retainCount]); NSArray *newArr = [[arr mutableCopy] retain]; NSLog(@”%ld”, [newArr retainCount]); [arr release]; NSLog(@”%ld”, [arr retainCount]); [newArr release]; NSLog(@”%ld”, [newArr … Read more

[Solved] Objective C NSArray [closed]

Your array is an array literal which means it is immutable. In order to make an array that you can change, do this: NSArray *oneInfo = @[@{@”trackTime”:theTrack[@”seconds”],@”trackPrice”:theTrack[@”price”],@”trackWait”:theTrack[@”wait”]}]; NSMutableArray* somethingICanChange = [oneInfo mutableCopy]; [somethingICanChange addObject: moreData]; Note that, if you are not using ARC (why not?), somethingICanChange is an array that you own and needs to … Read more

[Solved] Obj-C – How to pass data between viewcontrollers using a singleton?

Your addressing, and memory management is just plain… off. Firstly, there’s absolutely no reason to create a singleton for this, but that’s beside the point here. Secondly, when declaring properties, (atomic, assign) is defaulted to if not otherwise specified, which means your string: @property (nonatomic)NSString *passedValue; is weak sauce, ripe for deallocation and destruction at … Read more

[Solved] how do i get particular key value from string in swift4

Below is the sample code to parse your json string // I’ve escaped the double quotes so that it can run, you don’t need to do it because you already have the string let responseStr = “[{\”Loc_District\”:8119,\”districtname\”:\”अजमेर \”,\”District_NameEng\”:\”AJMER\”},{\”Loc_District\”:8104,\”districtname\”:\”अलवर \”,\”District_NameEng\”:\”ALWAR\”},{\”Loc_District\”:8125,\”districtname\”:\”बांसवाड़ा\”,\”District_NameEng\”:\”BANSWARA\”},{\”Loc_District\”:8128,\”districtname\”:\”बारां \”,\”District_NameEng\”:\”BARAN\”},{\”Loc_District\”:8115,\”districtname\”:\”बाड़मेर \”,\”District_NameEng\”:\”BARMER\”},{\”Loc_District\”:8105,\”districtname\”:\”भरतपुर \”,\”District_NameEng\”:\”BHARATPUR\”},{\”Loc_District\”:8122,\”districtname\”:\”भीलवाडा \”,\”District_NameEng\”:\”BHILWARA\”},{\”Loc_District\”:8101,\”districtname\”:\”बीकानेर \”,\”District_NameEng\”:\”BIKANER\”},{\”Loc_District\”:8121,\”districtname\”:\”बून्दी \”,\”District_NameEng\”:\”BUNDI\”},{\”Loc_District\”:8126,\”districtname\”:\”चित्तौड़गढ़ \”,\”District_NameEng\”:\”CHITTORGARH\”},{\”Loc_District\”:8102,\”districtname\”:\”चूरू \”,\”District_NameEng\”:\”CHURU\”},{\”Loc_District\”:8109,\”districtname\”:\”दौसा \”,\”District_NameEng\”:\”DAUSA\”},{\”Loc_District\”:8106,\”districtname\”:\”धौलपुर \”,\”District_NameEng\”:\”DHOLPUR\”},{\”Loc_District\”:8124,\”districtname\”:\”डूंगरपुर \”,\”District_NameEng\”:\”DUNGARPUR\”},{\”Loc_District\”:8099,\”districtname\”:\”गंगानगर \”,\”District_NameEng\”:\”GANGANAGAR\”},{\”Loc_District\”:8100,\”districtname\”:\”हनुमानगढ \”,\”District_NameEng\”:\”HANUMANGARH\”},{\”Loc_District\”:8110,\”districtname\”:\”जयपुर \”,\”District_NameEng\”:\”JAIPUR\”},{\”Loc_District\”:8114,\”districtname\”:\”जैसलमेर \”,\”District_NameEng\”:\”JAISALMER\”},{\”Loc_District\”:8116,\”districtname\”:\”जालोर \”,\”District_NameEng\”:\”JALORE\”},{\”Loc_District\”:8129,\”districtname\”:\”झालावाड … Read more

[Solved] Place JSON data in label in Swift [duplicate]

Try using Codable to parse the JSON response. Create the models like, struct Root: Decodable { let data: Response } struct Response: Decodable { let timeIn: String let timeOut: String } Now parse your JSON data like, if let data = data { do { let decoder = JSONDecoder() decoder.keyDecodingStrategy = .convertFromSnakeCase let response = … Read more

[Solved] How to use UIPickerView to show date months and Year(Upto 2015)?

It is as simple as that just copy paste this code in your viewdidload. Here in this code the setMaximumDate set the what you want for. That will be your Max Date. Here in this piece of code I used max date as TODAYS DATE. UIDatePicker *datePicker = [[UIDatePicker alloc]init]; datePicker.datePickerMode = UIDatePickerModeDate; [datePicker setMaximumDate:[NSDate … Read more

[Solved] Swift 4 Change Physics Gravity

CGVectorMake has been deprecated. Use the following syntax to initialise a CGVector: self.physicsWorld.gravity = CGVector(dx: 0, dy: 0) Or, since you want a vector with both components 0: self.physicsWorld.gravity = CGVector.zero solved Swift 4 Change Physics Gravity

[Solved] Quiz app to pick questions from 8 group of questions randomly?

Thanks for the advices guys. But I found the way on how to do it. I only changed the pickQuestion function. func pickQuestion () { if Questions.count > 0 && questionscount < 8{ QNumber = Int(arc4random_uniform(UInt32(Questions.filter{$0.Question.hasPrefix(“KEK”)}.count))) questionscount += 1 questionLabel.text = Questions.filter{$0.Question.hasPrefix(“KEK”)}[QNumber].Question self.title = “Ερώτηση: \(Int(questionscount))/50” answerNumber = Questions[QNumber].Answer for i in 0..<buttons.count{ buttons[i].setTitle(Questions[QNumber].Answers[i], for: … Read more