[Solved] ios UIView for complete viewController frame [closed]

-(UIView *) returnGradientView { UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)]; CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame = view.bounds; //change your color as you like, I have used black and white gradient.colors = @[(id)[UIColor blackColor].CGColor, (id)[UIColor whiteColor].CGColor]; [view.layer insertSublayer:gradient atIndex:0]; return view; } Edit this will create an gradient view, upper side white … Read more

[Solved] Color Variables in Objective C

What you have defined is a local variable. It is used like this: UIColor *lightGrayHeader = [UIColor colorWithRed:246/255.f green:239/255.f blue:239/255.f alpha:1.0]; self.view.backgroundColor = lightGrayHeader; If you want to use a static method on UIColor to fetch a colour, you could do this: @interface UIColor (MyColours) + (instancetype)lightGrayHeader; @end @implementation UIColor (MyColours) + (instancetype)lightGrayHeader { return … Read more

[Solved] Display integer in a UILabel [closed]

I would create a NSNumberFormatter and specify that is shouldn’t have any fraction digits. This will give you the rounding behavior you are expecting. NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; formatter.maximumFractionDigits = 0; // will be “2” since 1.5 is rounded up NSString *numberText = [formatter stringFromNumber:@1.5]; // will be “1” since 1.25 is rounded … Read more

[Solved] parse json using objective-c [closed]

you need to get the key as per your json. using that keys you will get the data. NSURL * url=[NSURL URLWithString:@”http://api.geonames.org/citiesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=demo”]; // pass your URL Here. NSData * data=[NSData dataWithContentsOfURL:url]; NSError * error; NSMutableDictionary * json = [NSJSONSerialization JSONObjectWithData:data options: NSJSONReadingMutableContainers error: &error]; NSLog(@”%@”,json); NSMutableArray * referanceArray=[[NSMutableArray alloc]init]; NSMutableArray * periodArray=[[NSMutableArray alloc]init]; NSArray * … Read more

[Solved] How to pass string value from one .m file to another .m file in iOS [closed]

if you wants to pass data from ViewControlerOne to ViewControllerTwo try these.. do these in ViewControlerOne.h @property (nonatomic, strong) NSString *str1; do these in ViewControllerTwo.h @property (nonatomic, strong) NSString *str2; Synthesize str2 in ViewControllerTwo.m @interface ViewControllerTwo () @end @implementation ViewControllerTwo @synthesize str2; do these in ViewControlerOne.m – (void)viewDidLoad { [super viewDidLoad]; // Data or string … Read more

[Solved] Bank Account iOS App Structure

The problem you’re facing is that you’re creating a new bank account every time instead of maintaining a single account and adding to it. In your original program you created an array of accounts acc that persisted during the lifetime of the user input. Since you’ve moved from a procedural program to a UI program … Read more

[Solved] UILocalNotification fire date computation

You can use NSCalendar and NSDateComponents to accomplish this. NSInteger daysToAdd = 5; NSDate *currentDate = [NSDate date]; NSDateComponents *comps = [[NSDateComponents alloc] init]; [comps setDay:daysToAdd]; NSDate *newDate = [[NSCalendar currentCalendar] dateByAddingComponents:comps toDate:currentDate options:0]; 4 solved UILocalNotification fire date computation

[Solved] POST method not working in ios

In iOS9, Apple added new feature called App Transport Security(ATS). ATS enforces best practices during network calls, including the use of HTTPS. Add the following in you info.plist You can add exceptions for specific domains in your Info.plist: <key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>testdomain.com</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSExceptionRequiresForwardSecrecy</key> <true/> <key>NSExceptionMinimumTLSVersion</key> <string>TLSv1.2</string> <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key> <false/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> … Read more

[Solved] Objective-C, How to count the number of TRUE booleans? [duplicate]

To Understand as Simple manner: int trueCount = 0; int falseCount = 0; for (<#initialization#>; <#condition#>; <#increment#>) { BOOL test3 = [test containsCoordinate:tg]; if (test3) { trueCount++; } else{ falseCount++; } } NSLog(@”True : %i”,trueCount); NSLog(@”False : %i”,falseCount); Implementation: -(void)markers{ NSURL *url = [NSURL URLWithString:@”http://example.com/api/s.php”]; data = [NSData dataWithContentsOfURL:url]; NSError *error; NSMutableArray *array = [NSJSONSerialization … Read more