WebView Controller




                      WebView Controller 

i) There is no need to change Main.m,  AppDelgate.h.
ii) Drag TextFields and buttons and maps to the related items.

AppDelegate.m

#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}

ViewController.h


#import <UIKit/UIKit.h>
@interface ViewController : UIViewController{
    IBOutlet UIWebView *web1;
    IBOutlet UIWebView *web2;
    IBOutlet UITextField *text;
    IBOutlet UITextField *text1;
    
}
-(IBAction)btn:(id)sender;

@end


ViewController.m


#import "ViewController.h"
@implementation ViewController
@synthesize arr;
@synthesize strName,strName1,strName2,strName3;

-(IBAction)btn:(id)sender
{
        NSString *str=[[NSString alloc]initWithFormat:@"http://%@",text.text] ;
        NSURL *url=[NSURL URLWithString:str];
     NSURLRequest *request=[NSURLRequest requestWithURL:url];
       [web loadRequest:request];

   // NSURL *url=[NSURL URLWithString:text.text];
    NSURL *url1=[NSURL URLWithString:text1.text];
    //NSURLRequest *request= [NSURLRequest requestWithURL:url];
    NSURLRequest *request1= [NSURLRequest requestWithURL:url1];
 //   [web1 loadRequest:request];  
    [web2 loadRequest:request1]; 
}


@end



tags: ios code examples, ios concepts, iphone sample codes, iphone sample projects, sample apps for iphone with source code, sample programs in iphone

PickerView Controller



                      PickerView Controller 

i) There is no need to change Main.m,  AppDelgate.h.

AppDelegate.m


#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    UINavigationController *nav=[[UINavigationController alloc]init]; 
    self.viewController.title=@"root";
    self.window.rootViewController = nav;
    [nav setTitle:@"pick item"];
    [nav addChildViewController:self.viewController];
    [self.window makeKeyAndVisible];
    return YES;
    
}

ViewController.h


#import <UIKit/UIKit.h>

@interface ViewController : UIViewController<UIPickerViewDelegate,UIPickerViewDataSource>{   
    IBOutlet UIPickerView *speedPicker;
    IBOutlet UILabel *lbl,*lbl1,*lbl2,*lbl3;
}
@property (nonatomic, retain) NSMutableArray *arr;
@property (nonatomic, retain) NSString *strName,*strName1,*strName2,*strName3;
@end


ViewController.m


#import "ViewController.h"
@implementation ViewController
@synthesize arr;
@synthesize strName,strName1,strName2,strName3;

- (void)viewDidLoad
{
    lbl.text=self.strName;
    lbl1.text=self.strName1;
    lbl2.text=self.strName2;
    lbl3.text=self.strName3;
    
// Do any additional setup after loading the view, typically from a nib.
    self.arr= [NSMutableArray arrayWithObjects:@"ramudu",@"laxman",@"anil",@"nagendra",@"sekhar",@"venki",@"suri", nil];
//    self.arr1= [NSMutableArray arrayWithObjects:@"apple",@"orange",@"banana",@"grapes",@"pine apple",@"promegranate", nil];
    speedPicker=[[UIPickerView alloc]init];
    speedPicker.delegate=self;
    speedPicker.dataSource=self;
    [super viewDidLoad];
}


// returns the number of 'columns' to display.
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
    return 4;
}

// returns the # of rows in each component..
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
    return [arr count];

}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    return [self.arr objectAtIndex:row];
 }
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    
    if(component==0)
    lbl.text =  [self.arr objectAtIndex:row];
    else if(component==1)    lbl1.text = [self.arr objectAtIndex:row];
    else if(component==2)    lbl2.text = [self.arr objectAtIndex:row];
    else   lbl3.text = [self.arr objectAtIndex:row];
}

@end




tags: ios code examples, ios concepts, iphone sample codes, iphone sample projects, sample apps for iphone with source code, sample programs in iphone

Table View Controller



                    TableView Controller 

i) There is no need to change Main.m,  AppDelgate.h.

AppDelegate.m


#import "AppDelegate.h"
#import "ViewController.h"


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}


ViewController.h



#import <UIKit/UIKit.h>

@interface ViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>{
    
    IBOutlet UITableView *tableStudents;
    NSArray *arrStudents,*arrEmployees;
}

@end


ViewController.m


#import "ViewController.h"

@implementation ViewController

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    NSLog(@"numberOfRowsInSection");
    if (section ==0) {
        
        return [arrStudents count];
    }
    else{
        
        return [arrEmployees count];
    }

}

// Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
// Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    NSString *strIdentifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:strIdentifier];
    if (cell == nil) {
        
        NSLog(@"cellForRowAtIndexPath row =%d,section=%d",indexPath.row,indexPath.section);
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:strIdentifier];
    }
    if (indexPath.section == 0) {
        
        cell.textLabel.text = [arrStudents objectAtIndex:indexPath.row];
    }
    else{
       
        cell.textLabel.text = [arrEmployees objectAtIndex:indexPath.row];
    }

    return cell;

}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    
    if (section == 0) {
        
        return @"Students";
    }
    else{
        return @"Employees";
    }
}// fixed font style. use custom view (UILabel) if you want something different

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{
    
    if (section == 0) {
        
        return @"Students";
    }
    else{
        return @"Employees";
    }

}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
    arrStudents = [[NSArray alloc]initWithObjects:@"Srinu",@"Rajesh",@"Kishore",@"Amar",@"Subhash", nil];
    arrEmployees =[[NSArray alloc]initWithObjects:@"Santhosh",@"Sandeep",@"Somu", nil];
}


@end



tags: ios code examples, ios concepts, iphone sample codes, iphone sample projects, sample apps for iphone with source code, sample programs in iphone, 


Navigation Controller


                    Navigation Controller 

Drag View and change it to navigation view controller.
i ) create two more viewcontroller.h,viewcontroller.m an viewcontroller.xib 's and map each other correctly then Insert headings for Views, Labels and buttons.
ii) There is no need to change Main.m,  AppDelgate.h.

AppDelegate.m


#import "AppDelegate.h"
#import "ViewController.h"


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(testingAppLevelNotificaions) name:@"test" object:nil];
    
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
    
     [[NSNotificationCenter defaultCenter]addObserver:self.viewController selector:@selector(test2) name:@"test" object:nil];
    UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:self.viewController];
    self.window.rootViewController = navController;
    [self.window makeKeyAndVisible];
    return YES;
}

ViewController.h


#import <UIKit/UIKit.h>
#import "SecondViewController.h"

@interface ViewController : UIViewController{
    
}
-(IBAction)goToSecond;
-(void)test2;
@end

ViewController.m


#import "ViewController.h"

@implementation ViewController

-(IBAction)goToSecond{    
    SecondViewController *second = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];
    [self.navigationController pushViewController:second animated:YES];
}

-(void)test2{

    NSLog(@"test2 method called");
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
    self.title = @"Root";
}


@end


SecondViewController.h


#import <UIKit/UIKit.h>


@interface SecondViewController : UIViewController

-(IBAction)goToThird;
@end



SecondViewController.m



#import "SecondViewController.h"
#import "ThirdViewController.h"

@implementation SecondViewController

-(IBAction)goToThird{
    
    ThirdViewController *third = [[ThirdViewController alloc]initWithNibName:@"ThirdViewController" bundle:nil];
    [self.navigationController pushViewController:third animated:YES];
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"Second";
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(test3) name:@"test" object:nil];
}
-(void)test3{
    
    NSLog(@"test3 called");
}


@end


ThirdViewController.h



#import <UIKit/UIKit.h>

@interface ThirdViewController : UIViewController{
    IBOutlet UILabel *lbl;
}

-(IBAction)postNotification;

@end



ThirdViewController.m


#import "ThirdViewController.h"

@implementation ThirdViewController

-(IBAction)postNotification{
    lbl.text=@"Third view controller";
    [[NSNotificationCenter defaultCenter]postNotificationName:@"test" object:nil];
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
@end



tags: iphone sample codes, iphone sample projects, sample apps for iphone with source code, sample programs in iphone, 

Action Sheet in IOS


                               Action Sheet For Iphone

Drag Labels and buttons
i ) Insert headings for some Labels and for other Labels map the Sliders.
ii) There is no need to change Main.m,  AppDelgate.h, AppDelegate.m ..

ViewController.h


#import <UIKit/UIKit.h>


@interface ViewController : UIViewController<UIActionSheetDelegate>{
  IBOutlet UILabel *lbl;  
}
-(IBAction)showAction;
@end

ViewController.m

#import "ViewController.h"

@implementation ViewController
-(IBAction)showAction
{
    UIActionSheet *action=[[UIActionSheet alloc]initWithTitle:@"Action" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:@"ok" otherButtonTitles:@"gmail", nil];
    [action showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    
    if (buttonIndex ==0) {
        lbl.text=@"Thanks";
    }
    if (buttonIndex ==1) {
        NSURL *url=[NSURL URLWithString:@"http://www.iosbricks.blogspot.com"];
        [[UIApplication sharedApplication]openURL:url]; 
    }
}


@end





tags: iphone sample codes, iphone sample projects, sample apps for iphone with source code, sample programs in iphone, 

UI CONTROLS|uikit framework reference



                          UI CONTROLS

1.Control: LABEL

Properties:  textColor, highlighted, text, BackgroundColor, font size, font color ,shadow color.
Methods:
- (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines;
- (void)drawTextInRect:(CGRect)rect;
Delegate Methods: NIL

2.Control: Button
Properties:
Type- Custom,Rounded Rect,Detail disclosure, info light ,info dark,Add contact
Title-title that appears to be on button.
Image- keep image as a button..
Background-background image of button..
Font-selected font style,size etc.,
Text color- the color of text that appears on button.
Alignment- text alignment that appears on button.
Methods:
- (void)setTitle:(NSString *)title forState:(UIControlState)state;            // default is nil. title is assumed to be single line
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;        // default if nil. use opaque white
- (void)setTitleShadowColor:(UIColor *)color forState:(UIControlState)state;  // default is nil. use 50% black
- (void)setImage:(UIImage *)image forState:(UIControlState)state;             // default is nil. should be same size if different for different states
- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;   // default is nil

- (NSString *)titleForState:(UIControlState)state;          // these getters only take a single state value
- (UIColor *)titleColorForState:(UIControlState)state;
- (UIColor *)titleShadowColorForState:(UIControlState)state;
- (UIImage *)imageForState:(UIControlState)state;
- (UIImage *)backgroundImageForState:(UIControlState)state;

- (CGRect)backgroundRectForBounds:(CGRect)bounds;
- (CGRect)contentRectForBounds:(CGRect)bounds;
- (CGRect)titleRectForContentRect:(CGRect)contentRect;
- (CGRect)imageRectForContentRect:(CGRect)contentRect;

Delegate Methods: NIL


3.Control:TEXTFIELD
Properties:
Text- entered text  in text field.
placeholder text- display  text in background.
Background-background image of textfield..
Font-selected font style,size etc.,
Text color- the color of text that appears on textfield.
Alignment- text alignment that appears on textfield.
Methods:
// drawing and positioning overrides

- (CGRect)borderRectForBounds:(CGRect)bounds;
- (CGRect)textRectForBounds:(CGRect)bounds;
- (CGRect)placeholderRectForBounds:(CGRect)bounds;
- (CGRect)editingRectForBounds:(CGRect)bounds;
- (CGRect)clearButtonRectForBounds:(CGRect)bounds;
- (CGRect)leftViewRectForBounds:(CGRect)bounds;
- (CGRect)rightViewRectForBounds:(CGRect)bounds;

- (void)drawTextInRect:(CGRect)rect;
- (void)drawPlaceholderInRect:(CGRect)rect;

// Presented when object becomes first responder.  If set to nil, reverts to following responder chain.  If
// set while first responder, will not take effect until reloadInputViews is called.
@property (readwrite, retain) UIView *inputView;            
@property (readwrite, retain) UIView *inputAccessoryView;

Delegate Methods:
@optional
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;        // return NO to disallow editing.
- (void)textFieldDidBeginEditing:(UITextField *)textField;           // became first responder
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField;          // return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end
- (void)textFieldDidEndEditing:(UITextField *)textField;             // may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;   // return NO to not change text

- (BOOL)textFieldShouldClear:(UITextField *)textField;
               // called when clear button pressed. return NO to ignore (no notifications)
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
              [textfieldname resignFirstResponder];
  return YES;
} // called when 'return' key pressed. return NO to ignore.



4.Control:Segmented Control
Properties:
Style-plain,bordered,bezeled,bar
State- momentary while selecting..
Segments-no. of segments
Segment -segment title
Image- keep image for each segment..
Methods:- (void)insertSegmentWithTitle:(NSString *)title atIndex:(NSUInteger)segment animated:(BOOL)animated; // insert before segment number. 0..#segments. value pinned
- (void)insertSegmentWithImage:(UIImage *)image  atIndex:(NSUInteger)segment animated:(BOOL)animated;
- (void)removeSegmentAtIndex:(NSUInteger)segment animated:(BOOL)animated;
- (void)removeAllSegments;

- (void)setTitle:(NSString *)title forSegmentAtIndex:(NSUInteger)segment;      // can only have image or title, not both. must be 0..#segments - 1 (or ignored). default is nil
- (NSString *)titleForSegmentAtIndex:(NSUInteger)segment;

- (void)setImage:(UIImage *)image forSegmentAtIndex:(NSUInteger)segment;       // can only have image or title, not both. must be 0..#segments - 1 (or ignored). default is nil
- (UIImage *)imageForSegmentAtIndex:(NSUInteger)segment;

- (void)setWidth:(CGFloat)width forSegmentAtIndex:(NSUInteger)segment;         // set to 0.0 width to autosize. default is 0.0
- (CGFloat)widthForSegmentAtIndex:(NSUInteger)segment;

- (void)setContentOffset:(CGSize)offset forSegmentAtIndex:(NSUInteger)segment; // adjust offset of image or text inside the segment. default is (0,0)
- (CGSize)contentOffsetForSegmentAtIndex:(NSUInteger)segment;

- (void)setEnabled:(BOOL)enabled forSegmentAtIndex:(NSUInteger)segment;        // default is YES
- (BOOL)isEnabledForSegmentAtIndex:(NSUInteger)segment;

Delegate Methods:NIL

5.Control:Switch
Properties:
State-on&off
On tint:Switch color
Methods:
- (id)initWithFrame:(CGRect)frame;              // This class enforces a size appropriate for the control. The frame size is ignored.

- (void)setOn:(BOOL)on animated:(BOOL)animated; // does not send action

Delegate Methods:NIL

6.Control:Slider
Properties:Values minimum to maximum And current ..
Methods:
- (void)setValue:(float)value animated:(BOOL)animated; // move slider at fixed velocity (i.e. duration depends on distance). does not send action

// set the images for the slider. there are 3, the thumb which is centered by default and the track. You can specify different left and right track
// e.g blue on the left as you increase and white to the right of the thumb. The track images should be 3 part resizable (via UIImage's resizableImage methods) along the direction that is longer
- (CGRect)minimumValueImageRectForBounds:(CGRect)bounds;
- (CGRect)maximumValueImageRectForBounds:(CGRect)bounds;
- (CGRect)trackRectForBounds:(CGRect)bounds;
- (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value;

Delegate Methods:NIL

7.Control:Progress View
Properties:Style-default,bar
Progress-0 to 1
methods:
- (void)setProgress:(float)progress animated:(BOOL)animated __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
Delegate Methods:NIL


8.Control: Activity Indicator View
Properties:
Style-gray,White,large White
Behavior- animating ,hides when stopped
Methods:
- (void)startAnimating;
- (void)stopAnimating;
- (BOOL)isAnimating;
Delegate Methods:NIL

9.Control: Stepper
Properties:
Value -minimum, maximum, current ,step
Methods:NIL
Delegate Methods:NIL


10.Control:Table View
Properties:
Style-plain,Grouped
Separator-Single line, single line etched
Selection-No selection,single selection,multiple selection
Editing-No selection During Editing, single selection During Editing, multiple selection During Editing
For scrollers
Style-white,black
Scrollers-shows horizontal scrollers,shows vertical scrollers,scrolling enabled,paging enabled,Direction Lock Enabled
Bounces-Bounces,Bounces horizontally,Bounces vertically
Zoom-min-max
Touches- Bounces Zoom,Delays Content touches, Cancelable Content To..

Methods:
- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style;                // must specify style at creation. -initWithFrame: calls this with UITableViewStylePlain

- (void)reloadData;                 // reloads everything from scratch. redisplays visible rows. because we only keep info about visible rows, this is cheap. will adjust offset if table shrinks
- (void)reloadSectionIndexTitles __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);   // reloads the index bar.

// Info

- (NSInteger)numberOfSections;
- (NSInteger)numberOfRowsInSection:(NSInteger)section;

- (CGRect)rectForSection:(NSInteger)section;                                    // includes header, footer and all rows
- (CGRect)rectForHeaderInSection:(NSInteger)section;
- (CGRect)rectForFooterInSection:(NSInteger)section;
- (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath;

- (NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point;                         // returns nil if point is outside table
- (NSIndexPath *)indexPathForCell:(UITableViewCell *)cell;                      // returns nil if cell is not visible
- (NSArray *)indexPathsForRowsInRect:(CGRect)rect;                              // returns nil if rect not valid

- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath;            // returns nil if cell is not visible or index path is out of range
- (NSArray *)visibleCells;
- (NSArray *)indexPathsForVisibleRows;

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated;
- (void)scrollToNearestSelectedRowAtScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated;

// Row insertion/deletion/reloading.

- (void)beginUpdates;   // allow multiple insert/delete of rows and sections to be animated simultaneously. Nestable
- (void)endUpdates;     // only call insert/delete/reload calls or change the editing state inside an update block.  otherwise things like row count, etc. may be invalid.

- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);

- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);

// Editing. When set, rows show insert/delete/reorder controls based on data source queries

@property(nonatomic,getter=isEditing) BOOL editing;                             // default is NO. setting is not animated.
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;

@property(nonatomic) BOOL allowsSelection __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);  // default is YES. Controls whether rows can be selected when not in editing mode
@property(nonatomic) BOOL allowsSelectionDuringEditing;                                     // default is NO. Controls whether rows can be selected when in editing mode
@property(nonatomic) BOOL allowsMultipleSelection __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);                 // default is NO. Controls whether multiple rows can be selected simultaneously
@property(nonatomic) BOOL allowsMultipleSelectionDuringEditing __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0);   // default is NO. Controls whether multiple rows can be selected simultaneously in editing mode

// Selection

- (NSIndexPath *)indexPathForSelectedRow;                                                // returns nil or index path representing section and row of selection.
- (NSArray *)indexPathsForSelectedRows __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0); // returns nil or a set of index paths representing the sections and rows of the selection.

// Selects and deselects rows. These methods will not call the delegate methods (-tableView:willSelectRowAtIndexPath: or tableView:didSelectRowAtIndexPath:), nor will it send out a notification.
- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition;
- (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated;

// Appearance

@property(nonatomic) NSInteger sectionIndexMinimumDisplayRowCount;              // show special section index list on right when row count reaches this value. default is NSInteger Max

@property(nonatomic) UITableViewCellSeparatorStyle separatorStyle;              // default is UITableViewCellSeparatorStyleSingleLine
@property(nonatomic,retain) UIColor               *separatorColor;              // default is the standard separator gray

@property(nonatomic,retain) UIView *tableHeaderView;                            // accessory view for above row content. default is nil. not to be confused with section header
@property(nonatomic,retain) UIView *tableFooterView;                            // accessory view below content. default is nil. not to be confused with section footer

- (id)dequeueReusableCellWithIdentifier:(NSString *)identifier;  // Used by the delegate to acquire an already allocated cell, in lieu of allocating a new one.

// when a nib is registered, calls to dequeueReusableCellWithIdentifier: with the registered identifier will instantiate the cell from the nib if it is not already in the reuse queue
- (void)registerNib:(UINib *)nib forCellReuseIdentifier:(NSString *)identifier __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);

@end

Delegate Methods:
@optional

// Display customization

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;

// Variable height support

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;

// Section header & footer information. Views are preferred over title should you decide to provide both

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;   // custom view for header. will be adjusted to default or specified header height
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;   // custom view for footer. will be adjusted to default or specified footer height

// Accessories (disclosures).

- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_3_0);
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath;

// Selection

// Called before the user changes the selection. Return a new indexPath, or nil, to change the proposed selection.
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
// Called after the user changes the selection.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);

// Editing

// Allows customization of the editingStyle for a particular cell located at 'indexPath'. If not implemented, all editable cells will have UITableViewCellEditingStyleDelete set for them when the table has editing property set to YES.
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);

// Controls whether the background is indented while editing.  If not implemented, the default is YES.  This is unrelated to the indentation level below.  This method only applies to grouped style table views.
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath;

// The willBegin/didEnd methods are called whenever the 'editing' property is automatically changed by the table (allowing insert/delete/move). This is done by a swipe activating a single row
- (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath;

// Moving/reordering

// Allows customization of the target row for a particular row as it is being moved/reordered
- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath;              

// Indentation

- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath; // return 'depth' of row for hierarchies

// Copy/Paste.  All three methods must be implemented by the delegate.

- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);

@end



DataSource Methods:
@required

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

// Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
// Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

@optional

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;              // Default is 1 if not implemented

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;    // fixed font style. use custom view (UILabel) if you want something different
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section;

// Editing

// Individual rows can opt out of having the -editing property set for them. If not implemented, all rows are assumed to be editable.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;

// Moving/reordering

// Allows the reorder accessory view to optionally be shown for a particular row. By default, the reorder control will be shown only if the datasource implements -tableView:moveRowAtIndexPath:toIndexPath:
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;

// Index

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView;                                                    // return list of section titles to display in section index view (e.g. "ABCD...Z#")
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index;  // tell table which section corresponds to section title/index (e.g. "B",1))

// Data manipulation - insert and delete support

// After a row has the minus or plus button invoked (based on the UITableViewCellEditingStyle for the cell), the dataSource must commit the change
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath;

// Data manipulation - reorder / moving support

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath;

@end





11.Control:Table View Cell-Defines the attributes and behavior of cells(rows)
Properties:
Style-custom,basic,right detail,left detail,Sub title
Selection-None,gray,blue
Accessory-disclosure  indicator,detail disclosure,checkbox.
Editing Acc.-disclosure  indicator,detail disclosure,checkbox.
Methods:
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;

Delegate Methods:NIL


12.Control:ImageView:
properties:
        image-to keep the image as a background
Methods:
- (id)initWithImage:(UIImage *)image;
- (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);
- (void)startAnimating;
- (void)stopAnimating;
- (BOOL)isAnimating;

Delegate Methods:NIL

13.Control:TextView
Properties:
text-write text to display
behavior-editable
capitalization-sentences, words, capital letters
detection:links,address,phone numbers,events

Delegate:(optional)
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView;
- (BOOL)textViewShouldEndEditing:(UITextView *)textView;

- (void)textViewDidBeginEditing:(UITextView *)textView;
- (void)textViewDidEndEditing:(UITextView *)textView;

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text;
- (void)textViewDidChange:(UITextView *)textView;

- (void)textViewDidChangeSelection:(UITextView *)textView;


14.control:web view
properties:scaling-scales page to fit
         detection:links,address,phone numbers,events

delegate:(optional)
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
- (void)webViewDidStartLoad:(UIWebView *)webView;
- (void)webViewDidFinishLoad:(UIWebView *)webView;
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error;

15.control:scroll view
 properties-
                   style-default,white,black
scrollers-shows horizontal scrollers,shows vertical scrollers,scrolling enabled,paging enabled,detection lock enabled.
bounce-bounces,bounces horizontally,bounces vertically.
Zoom-min to  max
touch-bounces,bounces horizontally,bounces vertically
interaction-user  interaction enabled,multiple touch
drawing-opaque,hidden,clears graphics context,clip subviews,auto resize subviews.
methods

delegate:- (void)scrollViewDidScroll:(UIScrollView *)scrollView;                                               // any offset changes
- (void)scrollViewDidZoom:(UIScrollView *)scrollView __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_2); // any zoom scale changes

// called on start of dragging (may require some time and or distance to move)
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;
// called on finger up if the user dragged. velocity is in points/second. targetContentOffset may be changed to adjust where the scroll view comes to rest. not called when pagingEnabled is YES
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
// called on finger up if the user dragged. decelerate is true if it will continue moving afterwards
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;

- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView;   // called on finger up as we are moving
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;      // called when scroll view grinds to a halt

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView; // called when setContentOffset/scrollRectVisible:animated: finishes. not called if not animating

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;     // return a view that will be scaled. if delegate returns nil, nothing happens
- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_2); // called before the scroll view begins zooming its content
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale; // scale between minimum and maximum. called after any 'bounce' animations

- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView;   // return a yes if you want to scroll to the top. if not defined, assumes YES
- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView;      // called when scrolling animation finished. may be called immediately if already at top

16 control:date picker
properties:mode-date and time
                   locale-english(united states)
                  interval-time in minutes
date&time-
constraints-min &max dates
timer- count down in seconds
interaction-user  interaction enabled,multiple touch
                  drawing-opaque,hidden,clears graphics context,clip subviews,auto resize subviews.
content-selected ,enabled,highlighted
methods:- (void)setDate:(NSDate *)date animated:(BOOL)animated;           // if animated is YES, animate the wheels of time to display the new date

17control:  picker View
behavior-shows selection indicator
interaction-user  interaction enabled,multiple touch
drawing-opaque,hidden,clears graphics context,clip subviews,auto resize subviews.
methods:// Reloading whole view or single component
- (void)reloadAllComponents;
- (void)reloadComponent:(NSInteger)component;

// selection. in this case, it means showing the appropriate row in the middle
- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated;  // scrolls the specified row to center.

- (NSInteger)selectedRowInComponent:(NSInteger)component;                                   // returns selected row. -1 if nothing selected

Delegate:
// returns width of column and height of row for each component.
- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component;
- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component;

// these methods return either a plain UIString, or a view (e.g UILabel) to display the row for the component.
// for the view versions, we cache any hidden and thus unused views and pass them back for reuse.
// If you return back a different object, the old one will be released. the view will be centered in the row rect
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view;

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component;





tags:ui controls in ios, uikit framework reference, uikit framework reference,ios concepts,ios controls library,ios controls

…… IMP FRAMEWORKS…..





              …… IMP FRAMEWORKS…..

Foundation framework:

            It provides foundation classes for objective-c.
such as NSobject,basic data types.

UIKit framework:

         It provides fundamental objects for managing the UI applications.

core location framework:

       It provides location based information using combination of GPS,cell ID,hi-fi networks.


Mapkit framework:

       It provides an Embedded map interface for your application.

Media player framework:

          It provides facilities for playing audio and video files.

core graphics framework:

          It provides c-based APIS for 2d rendering based on quartz drawing engine.

AVFoundation framework:

         It provides low level c APIS for audio recording and playback as well as managing audio hardware.


FOR ALL FRAMEWORKS VISIT THIS


Click Here...





tags:uikit framework reference, ios concepts, ios frameworks

IOS IMPORTANT INTERVIEW QUESTIONS


                   

                             IOS IMPORTANT INTERVIEW QUESTIONS


What are SDK tools in iPhone?
XCode
IB
Simulator
Instruments

What is Xcode?
Xcode is an Intigrated Development Environment IDE
it acts like an Editor of Objective c lang, We can write,run,build our code in xcode.

What is the simulator?
it is a demo to check our applications if we didn't have the original device

what are Instruments:
               The instrument enables you to dynamically trace and profile the performance of the Macos , iPhone, iPad applications.
Bu using Instruments we can test the performance of the application.

what is Interface Builder:
                  Interface builder is developed in 1988.It is a visual tool that allows you to design your interfaces for iphone. By using interface builder we can drag and drop the views on interface.

Explain about Inspector
                   It is mainly used for setting the properties of view elements. It contains four sections.
1)Attribute inspector
2)Connection 
3)Size of inspector  
4)Identity

Groups and File sections:
   Classes:
                        In class folder actual coding will be their.
for window based application we have two files.
1)appdelegate.h  
2)appdelegate.m                
For view based applications we have four files.
1)appdelegate.h 
2)appdelegate.m                         
3)viewcontrol.h   
4)viewcontrol.m

what is optimization?
Optimaisation is nothing but
Making our application more attractively even after complition of the coding

how can we use multiple class inheritance in objective c?
In Objective c Multiple inheritance is not supported
for this propous we use "categories" in Objective c

How can u use object for abstract class?
(or) What is Shared Obj?
We  can't create object for abstract class
to call abstract class we use Shared obj

What are the types of accessory methods?
we have 2 types of accessor methods:

i.Getter method:
            Getter method is an accessor method that retrieves the value of an instance variable.

ii.Setter method:
            Setter method is an accessor method that Sets the value of an instance variable.

what is a Selector?
        Selector can either be a name of method Or message to an object.

What is Delegate?
         it is an object that usually read to some events in another object      
       A Deligate allows one object to send messages to another object when an Event happens.
       An object directly to carryout an action by another object.

What is an App Delegate..?
it is necessary in any app.
it is a controller which takes care critical events
whle Starting Running and Editing applications

iPhone Paths:

   iPhone contains two paths.
   1.Resource path:  By using this path we can retrieve the data from resource path.But we can not add the data. 2.Modify path By using this path we can add,modify,delete,retrieve the data.
Accelerometer:           
                      The accelerometer allows the device to detect the orientation of the device and adapts the content to suit the new orientation.
 Header file:
            header files are preprocessor directories.
         in Obj c By using #include,#import we can import the header files.
Resources:
                  In resources we can add the outside contents like images,videos,audio files.
                  It contains info.plist file.plist file having entire project information.
Products:

              The final output present in product folder and extension is .app
              Intiallu .app is in red color.once if you can build the  app then the .app is created.
 Files owner window:
            It contains copy of nib files.
           It is always 1st icon in any .nib file.
 what Enum?
          It is a user defined data type.it improves speed of execution.
         By default it assigns range from 0,1……
 Interface:
 In interface section that declares the methods and instance variables of class.
 Implementation:
             In implementation section that actually defines the class.
 what kind of design pattern we are using?
  we are using model view controller
                 Model:
                             This layer manipulates the coding part of the application.
                 View: This layer manipulates the design part of the application.
                Controller: This layer acts as bridge between model and view controller.
 what is Id?
It is a datatype.Id is a generic c-type used by obj-c to refer to any object.
  
NSFile manager:

                        By using NSfile manager we can compare,add,delete and update the data in database.

NSBundle mainbundle:

                       It is used to pick the data from resources.
UI application:

                 Every iPhone has UI application.it is the starting point of the every application.
                 It is responsible for initializing and display your application on UI Window and also responsible for loading your application.

Controllers in iPhone:

                 By using controllers we can move from one view to another view.
                       ex:pushviewcontroller, popviewcontroller, presentmodelviewcontroller,Dismissmodelviewcontroller.
How can we deploy our app?
By using standard edition worths 99$ we we can deploy our app

How can we Localize our app?
or localization have to use current language
For exam to make a delete button
in English: Delete
in Japanish lan: Aurem
in spanish: Delat
in this way we can localize our app

why e use Authentication?
for the security purpose we use authentication

When keyboard appears, hides some part of UI for that what shall we do?

kea board will appear only in some views like "Textfield","Textviews" etc
but not in all the views

for display the keyboard we have to use "becomeFirstResponder"..
for display the keyboard we have to use "resignFirstResponder"
ex:
[textField becomeFirstResponder];
[textField resignFirstResponder];

What is awakeFromNib, becomeFirstResponder?
activity should be allocated from loading xib file, it should be not nil in awakFromNib
And awakeFromNib is called when all file owners outlets and properties are set (including view property).
So it makes sense that viewDidLoad is called earlier than awakeFromNib.

becomeFirstResponder?
for display the keyboard we have to use "becomeFirstResponder"..
ex:[textField becomeFirstResponder];

what happens when we invoke a method on a nil pointer
It returns 0, nil, a structure filled with 0s,
multiple class inheritance in objective c?
In Objective c Multiple inheritance is not supported
for this propous we use "categories" in Objective c

Categories:
A category allows you to add methods to an existing class
Categories are a powerful feature that allows you to extend the functionality of existing classes without subclassing.
The declaration of a category interface looks very much like a class interface declaration
except the category name is listed within parentheses after the class name and the superclass isn’t mentioned.
Extensions:
Class extensions are like anonymous categories,
except that the methods they declare must be implemented in the
main @implementation block for the corresponding class.

extensions allow you to declare additional required methods for a class
 in locations other than within the primary class @interface block,

 What is XML parsing?
xml parsing is the trancefer of data from xml page to our application
the data which is in term of elements

what r the Delegate Methods for XML Parsing?
There are mainly 3Tyoes of Deligate metots for XML Parsing
 i. did start eliment
ii. did end eliment
iii. found characters

What is Picker view..?
Picker view lets the user select an item from a list.

What is Table view?
It is commonly used to show list of data in the form of Records

WEb Services?
Web services are application programing interfaces [API]
or Web API's that are acceced via Hyper Text protocol and excited on a remote system
hosting the requested services

Differnce between HTML & XML?
XML was designed to transfer and store the data
XML was to carry data not to display the data
XML is designed to be self description. 
HTML was designed to Display the data 

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Blogger Templates