Tuesday, November 6, 2012

To Create UIView and Empty Xib separately Navigate one ViewController To another manualy created Xib.





For Example:

1.New file--> cocoa Touch-->objective-c class---> UIView--->give viewname. // for uiview

2.New file--> User Interface-->Empty---> iPad(or)iPhone--->give name.// xib



1.AppDelegate.h

@interface SpeedcalcAppDelegate : NSObject <UIApplicationDelegate>
{
UINavigationController *Toggle;

}

2.AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
Toggle=[[UINavigationController alloc]init];
[Toggle setNavigationBarHidden:YES animated:NO];
SpeedcalcViewController *test=[[SpeedcalcViewController alloc]init]; // Created ViewController
[Toggle pushViewController:test animated:NO];
[test release];
[window addSubview:Toggle.view];

}


3.ViewController.M

-(IBAction)btnnext_Clicked
{
NSLog(@"agaskjhlkasdjflas");
FmtyShareActivity *Test=[[FmtyShareActivity alloc]initWithFrame:CGRectMake(0, 0, 891, 500)]; // Assign view frame.
Test.center = self.view.center;
[self.view addSubview:Test];
}

4.Demoview.M


- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
NSArray *nibArray=[[NSBundle mainBundle] loadNibNamed:@"ShareActivity" owner:self options:nil]; // Xib Name
[self addSubview:[nibArray objectAtIndex:0]];
}
return self;
}


5.Manualy Created Xib

Ex:
ShareActivity.xib

Custom Class-->Class :[Demoview] // assign to custom class.



No comments:

Post a Comment