Add Tabbar Background Image

Birincisi:

DidLoad

//Tabbar Background icin
tabbar.backgroundColor = [UIColor clearColor];
CGRect frame = CGRectMake(0, 0, 320, 62);
UIView *v = [[UIView alloc] initWithFrame:frame];
UIImage *i = [UIImage imageNamed:@"tabbar.png"];
UIColor *c = [[UIColor alloc] initWithPatternImage:i];

// UIColor *c = [UIColor blueColor];
v.backgroundColor = c;
[c release];
[[self tabbar] insertSubview:v atIndex:0];
[v release];

 

İkincisi:

ontents of AppDel.h File.

#import <UIKit/UIKit.h>

@interface cTabBarAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {

}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
@property (nonatomic, retain) IBOutlet UIImageView *imgV;

@end

Contents of AppDel.m File.

#import "cTabBarAppDelegate.h"

@implementation cTabBarAppDelegate
@synthesize window=_window;
@synthesize tabBarController=_tabBarController;
@synthesize imgV = _imgV;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.tabBarController.delegate=self;
    self.imgV.frame=CGRectMake(0, 425, 320, 55);
    [self.tabBarController.view addSubview:self.imgV];
    self.tabBarController.selectedIndex=0;
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];
    return YES;
}

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
    NSUInteger index=[[tabBarController viewControllers] indexOfObject:viewController];
    switch (index) {
        case 0:
            self.imgV.image=[UIImage imageNamed:@"tBar1.png"];
            break;
        case 1:
            self.imgV.image=[UIImage imageNamed:@"tBar2.png"];
            break;
        case 2:
            self.imgV.image=[UIImage imageNamed:@"tBar3.png"];
            break;
        case 3:
            self.imgV.image=[UIImage imageNamed:@"tBar4.png"];
            break;
        case 4:
            self.imgV.image=[UIImage imageNamed:@"tBar5.png"];
            break;
        default:
            break;
    }
    return YES;
}
Devamını Oku » Yorum Yok »

Hide Status Bar XCode

Screen shot 2011 12 14 at 5.29.40 PM Hide Status Bar XCode

 [[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackTranslucent];
Devamını Oku » Yorum Yok »

UIViewAnimation From Left To Right Animation



- (void) animationStep1
{

imageView2.left = imageView.right;

[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:50.0];

[UIView setAnimationDelegate:self];

[UIView setAnimationDidStopSelector:@selector(animationStep2)];

[UIView setAnimationCurve:UIViewAnimationCurveLinear];

imageView.right = 0;

imageView2.left = 0;

[UIView commitAnimations];

}

- (void) animationStep2

{

imageView.left = imageView2.right;

[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:50.0];

[UIView setAnimationDelegate:self];

[UIView setAnimationDidStopSelector:@selector(animationStep1)];

[UIView setAnimationCurve:UIViewAnimationCurveLinear];

imageView2.right = 0;

imageView.left = 0;

[UIView commitAnimations];

}
Devamını Oku » Yorum Yok »

ScrollView Kullanimi

UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 400)];

view1.backgroundColor = [UIColor blueColor];

[self.view addSubview:view1];

CGRect scrollViewFrame = CGRectMake(0, 0, 320, 300);

UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:scrollViewFrame];

//[self.view addSubview:scrollView];

[self.view addSubview:scrollView];

CGSize scrollViewContentSize = CGSizeMake(320, 360);

[scrollView setContentSize:scrollViewContentSize];

[scrollView addSubview:view1];

[scrollView setPagingEnabled:YES];

Devamını Oku » Yorum Yok »

NSMutable String Kullanımı

- (void) sayHello: (NSString*) name {

NSMutableString *message = [[NSMutableString alloc] initWithString:@”Antalya”];

[message appendString:name];

NSLog(message);

[message release];

}

Devamını Oku » Yorum Yok »

UpperCase String Kullanimi

 //UppercaseString

NSString *string1 = @”yusuf ozkan”;

NSString *upperString = [[NSString alloc] initWithFormat:string1 arguments:nil];

NSString *changeString = [upperString uppercaseString];

NSLog(@”%@”,changeString);

[upperString release];

Devamını Oku » Yorum Yok »

NSDictionary – NS Array Kullanımı XCode

 NSDictionary Kullanımı 

ornek.h  - interface bölümü

@interface adidViewController : UIViewController {

NSDictionary *dictionary;

}

end

 

ornek.m – implementation bölümü

//NS Dictionary

NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", @"key3", nil];

NSArray *objects = [NSArray arrayWithObjects:@"How", @"are", @"you", nil];

dictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];

for (id key in dictionary)

{

NSLog(@”key: %@, value: %@”, key, [dictionary objectForKey:key]);

}

 

Devamını Oku » Yorum Yok »

UIView Kullanımı

UIView Katman Yapısı

Sırası ile

1- Window

2- TabbarView veya UIViewController olabilir.

3- Navigation Controller

4- View, Componentler

Devamını Oku » Yorum Yok »

Tarih Formatı Ayarlamak Gün Ay Yıl XCode

Xcode

//DateFormatter

NSTimeInterval secondsPerDay = 24 * 60 * 60;

NSTimeInterval secondsPerDay2 = 2* 24 * 60 * 60;

NSTimeInterval secondsPerDay3 = 4* 24 * 60 * 60;

//Gun

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

[dateFormatter setDateFormat:@"dd"];

//Ay

NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];

[dateFormatter1 setDateFormat:@"MMMM"];

Devamını Oku » Yorum Yok »

View Background Image Xcode

Background image vermek icin gerekli kodu viewDidLoad kismina yaziniz ve background imagenizi  uygumalaminiza atiniz.

[code language="cpp"]

- (void)viewDidLoad

{

[super viewDidLoad];

//Background

self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"yellow.jpg"]];
<!--more-->
&nbsp;

}

[/code]

Devamını Oku » Yorum Yok »
 Page 1 of 2  1  2 »