Posts

Objective-C Arrays

Objective-C programming language provides a data structure called  the array , which can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type. Instead of declaring individual variables, such as number0, number1, ..., and number99, you declare one array variable such as numbers and use numbers[0], numbers[1], and ..., numbers[99] to represent individual variables. A specific element in an array is accessed by an index. All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element. NSArray * attributes = @[@ "H:S" ,@ "H:W" ,@ "H:AGR" ,@ "H:TPC" ,@ "H:P" ,@ "H:TI" ]; NSMutableArray * attributes = [@ "H:S" ,@ "H:W" ,@ "H:AGR" ,@ "H:TPC...

AV Player.

View.m #pragma mark -   AV player launch                                    dispatch_async ( dispatch_get_main_queue (), ^( void ){                                            AVAsset *asset = [ AVURLAsset URLAssetWithURL :Song_url options : nil ];                      playerItem = [ AVPlayerItem playerItemWithAsset :asset];                                            [ gp . aPlayer_main replaceCurrentItemWithPlayerItem : playerItem ];                                            self . time...

Collection View

Collection View View.h <UICollectionViewDelegate , UICollectionViewDataSource > IBOutlet UICollectionView *Vw_Collect; View.m   [ Vw_Collect setDelegate : self ];     [ Vw_Collect setDataSource : self ];     [ Vw_Collect setBackgroundColor :[ UIColor groupTableViewBackgroundColor ]];          UINib *cellNib = [ UINib nibWithNibName : @"Task_FloreCollectionViewCell" bundle : nil ];      [ Vw_Collect registerNib :cellNib forCellWithReuseIdentifier : reuseIdentifier ]; #pragma mark -- CollectionViewDataSource //Collectionview Methods - ( NSInteger )numberOfSectionsInCollectionView:( UICollectionView *)collectionView {     return 1 ; } - ( NSInteger )collectionView:( UICollectionView *)collectionView numberOfItemsInSection:( NSInteger )section {     return ValArr2 . count ; } - ( UICollectionViewC...

Rendom Select Background

View.m NSArray *main_background=[[ NSMutableArray alloc ] initWithObjects : @"mainscreen2.png.jpg" , @"background_2.jpg" , @"background_3.jpg" , @"background_4.jpg" , @"background_5.jpg" , @"background_6.jpg" , @"background_7.jpg" , @"background_6.jpg" , @"background_5.jpg" , @"background_3.jpg" , nil ];               bgindx = arc4random () % [main_background count ];     //NSArray *main_img=[[NSArray alloc]initWithObjects:@"mainscreen2.png.jpg", nil];               UIGraphicsBeginImageContext ( self . view . frame . size );     [[ UIImage imageNamed :[main_background objectAtIndex :  bgindx ]] drawInRect : self . view . bounds ];      UIImage *image = UIGraphicsGetImageFromCurrentImageContext ();

Table Style (Border)

How to give table border in iOS yourtblname. layer . borderWidth = 2.0 ; yourtblname . layer . borderColor = [ UIColor redColor ]. CGColor ;

Text field Validation for Password

Validation -( BOOL )validation {     NSLog ( @"lat %@" ,[ AppDelegate sharedAppDelegate ]. latitud );     if ([ txt_username . text isEqualToString : @"" ])     {         [[ AppDelegate sharedAppDelegate ] showAlertWithTitle : ERROR_HEADER message : USERNAME_BLANK_MSG ];         return NO ;     }     else if ([ txt_email . text isEqualToString : @"" ])     {         [[ AppDelegate sharedAppDelegate ] showAlertWithTitle : ERROR_HEADER message : EMAIL_BLANK_MSG ];         return NO ;     }     else if ([[ ApplicationData sharedInstance ] ValidEmail : txt_email . text ] == NO )     {         [[ AppDelegate sharedAppDelegate ] showAlertWithTitle : ERROR_HEADER message : EMAIL_MSG ];         return NO ;     }   ...

Table view with cell

View.h File #import "DefaultTableViewCell.h" take delegetes @interface DefaultSideTableViewController : UIViewController < UITableViewDelegate , UITableViewDataSource > View.m  File #pragma marl - UITableView Data Source - ( NSInteger )tableView:( UITableView *)tableView numberOfRowsInSection:( NSInteger )section {     NSLog ( @"ItemList %@" , ItemList );     if (tableView == rearTableView )     {         return ItemList . count ;     }     else     {         return ItemList . count ;     } } - ( NSInteger )numberOfSectionsInTableView:( UITableView *)tableView {     return 1 ; } - ( UITableViewCell *)tableView:( UITableView *)tableView cellForRowAtIndexPath:( NSIndexPath *)indexPath {     DefaultTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier : Cell...