Friday, 6 July 2012

Creating Tabs on a view controller. and its Delegate

- (void)viewDidLoad {
    [super viewDidLoad];

UITabBar *m_tabbar;
if(m_tabbar)
        [m_tabbar removeFromSuperview];
   
    m_tabbar =  [[UITabBar alloc] initWithFrame:CGRectMake(0,422,320,40)];
    m_tabbar.backgroundColor = [UIColor redColor];
    [m_tabbar setDelegate:self];
    UITabBarItem* setttings = [[[UITabBarItem alloc] initWithTitle:@"Most Recent" image:[UIImage imageNamed:@"Settings.png"] tag:1]autorelease];
    UITabBarItem* mapbutton = [[[UITabBarItem alloc] initWithTitle:@"Community" image:[UIImage imageNamed:@"map.png"] tag:2]autorelease];
    UITabBarItem* nilbutton = [[[UITabBarItem alloc] initWithTitle:@"Settings" image:[UIImage imageNamed:@"locate.png"] tag:3]autorelease];
    NSArray* tabBarItems = [NSArray arrayWithObjects:setttings, nilbutton,mapbutton, nil];
    m_tabbar.items = tabBarItems;

self.view addSubview:m_tabbar];
    [m_tabbar setSelectedItem:[m_tabbar.items objectAtIndex:0]];

}


- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
    switch (item.tag)
    {
        case 1:{
            Settings * setii=[[Settings alloc]init];
           [self.navigationController pushViewController:setii animated:YES];
            break;
        }
        case 2:
                    
            break;
           
           
        case 3:
        {
                       break;
        }   
        default:
            exit(0);
            break;
    }
}

Thursday, 5 July 2012

Navigating to a Tabbar Tab View


[self.tabBarController setSelectedIndex:1];

Adding a Line in Cell

UIView *lineView            = [[[UIView alloc] initWithFrame:CGRectMake(0, 68, 300, 1.5)] autorelease];
                lineView.backgroundColor    = [UIColor whiteColor];
                lineView.autoresizingMask   = 0x3f;
                [cell.contentView addSubview:lineView];

Round Corner imageView

imageView = [[UIImageView alloc] init];
    imageView.frame = CGRectMake(13.0f, 98.0f, 106.0f, 106.0f);
   
    CALayer * l = [imageView layer];
    [l setMasksToBounds:YES];
    [l setCornerRadius:8.0];
   
    [self.view addSubview:imageView];
   
     imageView.image = [UIImage imageNamed:@"imgee.png"];


//Add and Import  Quartscore frame work.

Adding BG Image to the cells

UIImage*    backgroundImage = nil;
    UIImageView* backgroundView    = [[UIImageView alloc] initWithFrame:cell.frame];
    if (indexPath.row == 0)
    {
        backgroundImage = [UIImage imageNamed:@"top_cell.png"];
       
    }
    else if (indexPath.row ==[xmlElementObjects count]-1)
    {
        backgroundImage    =[UIImage imageNamed:@"bottom_cell.png"];
    }
    else
    {
        backgroundImage    =[UIImage imageNamed:@"middle_cell.png"];
       
    }
    backgroundView.image = backgroundImage;
    [cell setBackgroundView:backgroundView];
   
    if (backgroundView)
    {
        [backgroundView release];
        backgroundView = nil;
    }