In this application we are going to create it by using Window based application.
In this application we are going to create it by using Window based application.In this application we are going to create it by using Window based application.
So we will find one window.
There is .h and .m file.
We are going to add Switch to Window.
Create a new project by selecting Window-Based Application.Open the Interface Builder by double clicking the MainWindow.xib file and add a Switch from the library.
IBOutlet UISwitch *mswitch;
(-(void)switchAction:(id)sender;)
{
UIWindow *window;
IBOutlet UISwitch *mswitch;
}
-(void)switchAction:(id)sender;
@end
In this we are writing the method for switch
e connection in interface builder
import "SwitchAppDelegate.h"
@implementation SwitchAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
[window ]; eKeyAndVisible
}
-(void)switchAction:(id)sender
{
if([mswitch isOn])
{
NSLog(@"Switch is ON");
}
else
{
NSLog(@"Switch is OFF");
}
}
- (void)dealloc
{
[window release];
[super dealloc];
}
@end