Showing posts with label iOS Tip. Show all posts
Showing posts with label iOS Tip. Show all posts

Thursday, July 18, 2013

Can not save NSDictionary with NSUserDefaults!!

One of the reason is one of which is of type NSNull which is not a property list value. iterate over the keys of the dictionary I just produced so conveniently with dictionaryWithValuesForKeys and remove those of type NSNull



NSMutableDictionary* dict = [NSMutableDictionary dictionaryWithDictionary:currentNullValueDic];
 for( id key in [dict allKeys] )
  {
       if( [[dict valueForKey:key] isKindOfClass:[NSNull class]] )
          {
                          [dict setObject:@"" forKey:key];
          }
}

Monday, October 10, 2011

iPhone Development (Object C) Tip

  1. How to create (access) AppDelegate object

                 projectNameAppDelegate* sharedApplication = (projectNameAppDelegate *) 
                                                                                                         [[UIApplication sharedApplication] delegate];



                 Using this Object you can access main Window also.
      
         2.   Scheduling to method  


                [NSTimer scheduledTimerWithTimeInterval:1.0f target:self
                                       selector:@selector(didFinishMainURL) userInfo:nil repeats:NO]; 
     
     

          3. Re-create frame parameter from existing frame

               
                UIImageView *imageView = [productRowData objectForKey:@"product_image"];
                CGRect rect = imageView.frame;
                rect.size.height = 80;
                rect.size.width = 75;
                imageView.frame = rect;
                imageView.tag = 0;    // tag our images for later use when we place them in serial fashion
                CGRect frame = imageView.frame;
                //frame.origin = CGPointMake(15, 3);
                frame.origin = CGPointMake(0, 0);
                imageView.frame = frame;