How to add UINavigationController to UITabbarController Programatically?


Hi,

Today I am going to Explain you How to Add UINavigation Controller to UITabbarController.

  • When you add UIViewController to UIWindow Your Application become ViewControllerBase(SingleView) Application.
  • When you add UIViewController to UINavigationController your application become NavigationBased(Master-Detail) Application.
  • When you add UIViewController/UINavigationController to your UITabbarController Your application become Tabbased Application.

so here we are using the same concept that add your Navigation Controller to UITabbarController so you will get Push/Pop effect in UITabbar Controller.

//Initialize tabbar Controller and All Navigation Controllers are added into Tabbar Controller
self.tabbar = [[UITabBarController alloc] init];
NSArray *arrNVControllers = [NSArray arrayWithObjects:nav1,nav2,nav3,nav4, nil];

self.tabbar.viewControllers = arrNVControllers;

Download the sample code from Here

Advertisements

Perform Lazy Loading with Image Cache(HJCache)


Hi,

I am going to explain you how to perform lazy loading with Image Cache using HJCache.It will cache your images according to your requirements. I have perform caching for 1 week.Now i am showing you the steps for achieving you task very simple way.

Step 1:Drag and Drop HJcache Classes into your Project(I have already Provided)

step 2: In Application Delegate Import “HJObjManager.h” file and Make an Object of It.

Step 3:In Application Delegate.m file @synthesize the Object write the following code for Image caching.

Step 4: Now import “HJManagedImageV.h” where you want to implement the lazy loading.

Step 5. Make the custom cell and Take UIView instead of UIImageview in your Custom cell and inherit  Class “HJManagedImageV” as shown here.

Step 6: In use the Object of HJManagedImageV and provide the URL from your Array/Dictionary other things are managed by HJcache Object it self.

Now your task is getting completed.You can have the complete code by Clicking Here

How to change iPhone/iPad Navigation Bar Title text color and other Property?


Hi,

In iPhone/iPad several times we need to develop some custom controls or we need to change existing attribute.same way here i am going to explain how to change UINavigationbar’s title property like  font,color,size etc.

You need to use a UILabel as the titleView of the navigationItem.

The label should:

  • Have a clear background color (label.backgroundColor = [UIColor clearColor]).
  • Use bold 20pt system font (label.font = [UIFont boldSystemFontOfSize: 20.0f]).
  • Have a shadow of black with 50% alpha (label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5]).
  • You’ll want to set the text alignment to centered as well (label.textAlignment = UITextAlignmentCenter).

Set the label text color to be whatever custom color you’d like. You do want a color that doesn’t cause the text to blend into shadow, which would be difficult to read.

I worked this out through trial and error, but the values I came up with are ultimately too simple for them not to be what Apple picked. 🙂

If you want to verify this, drop this code into initWithNibName:bundle: inPageThreeViewController.m of Apple’s NavBar sample. This will replace the text with a yellow label. This should be indistinguishable from the original produced by Apple’s code, except for the color.

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {   
  self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];    
 if (self)     {         // this will appear as the title in the navigation bar    
     UILabel *label = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease];      
   label.backgroundColor = [UIColor clearColor];         
 label.font = [UIFont boldSystemFontOfSize:20.0];       
   label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];       
   label.textAlignment = UITextAlignmentCenter;      
   label.textColor = [UIColor yellowColor]; // change this color      
   self.navigationItem.titleView = label;          
 label.text = NSLocalizedString(@"PageThreeTitle", @"");       
   [label sizeToFit];    
 }    
 return self;
 }