Skip to main content

Posts

Showing posts from September, 2017

Set Date And Time Picker In Objective C

Set Date picker And Time // Set Date picker... UIDatePicker *datePicker = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, 0, 320, 50)]; [datePicker setDate:[NSDate date]]; datePicker.datePickerMode=UIDatePickerModeDate; [datePicker addTarget:self action:@selector(updateTextField:) forControlEvents:UIControlEventValueChanged]; [txtDate setInputView:datePicker]; // Set Toolbar for DatePicker... UIToolbar* dateToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)]; dateToolbar.barStyle = UIBarStyleBlackTranslucent; dateToolbar.items = [NSArray arrayWithObjects: [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], [[UIBarButtonItem alloc]initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(Done)],nil]; [dateToolbar sizeToFit]; txtDate....

Set Navigation Bar Title And Its Color In Your View

Navigation title and its color //  Put Code In Your ViewDidLoad() [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES]; UIBarButtonItem *anotherButton1 = [[UIBarButtonItem alloc] initWithTitle:@"Home" style:UIBarButtonItemStylePlain target:self action:@selector(Save)]; self.navigationItem.leftBarButtonItem = anotherButton1; // Navigation title and its color... self.title=@"RECEIVE JOB"; self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:44.0/255.0 green:144/255.0 blue:255/255.0 alpha:1.0]; [self.navigationController.navigationBar setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor whiteColor], NSForegroundColorAttributeName, [UIFont fontWithName:@"HelveticaNeue" size:18], NSFontAttributeName, nil]]; UINavigationBar *bar = [self.navigationController navigationBar]; [bar setTintColor:[UIColor whiteColor]]; ...

How To GET CURREN LOCATION ON MAP in Objective C

GET CURREN LOCATION ON MAP ///  Using CoreLocation.framework File..h --------- #import <CoreLocation/CoreLocation.h> @interface ReceiveJobView : UIViewController<CLLocationManagerDelegate> {       CLLocationManager *locationManager; } @end ------------- File..m ------------- #import <CoreLocation/CoreLocation.h> - (void)viewDidLoad {      UIToolbar* numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];      numberToolbar.barStyle = UIBarStyleBlackTranslucent;      numberToolbar.items = [NSArray arrayWithObjects:      [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace           target:nil action:nil],      [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace         target:nil action:nil],   ...

How To Use Hide And Show Keyboard And Set View Animations In UITextField In Objective C

KEYBOARD HIDE AND SHOW AND VIEW ANIMATIONS IN TEXT FIELD ViewController.h float animatedDistance; ViewController.m - (void)textViewDidBeginEditing:(UITextView *)textView {      CGRect textFieldRect=[self.view.window convertRect:textView.bounds fromView:textView];      CGRect viewRect=[self.view.window convertRect:self.view.bounds fromView:self.view];      CGFloat midline=textFieldRect.origin.y + 0.5 * textFieldRect.size.height;      CGFloat numerator = midline - viewRect.origin.y - 0.2 * viewRect.size.height;      CGFloat denominator = (0.8 - 0.2) * viewRect.size.height;      CGFloat heightFraction=numerator / denominator;           if (heightFraction < 0.0)           {                heightFraction= 0.0;           }           ...

How To Set UIBarButtonItem In IOS Objective C

Set A UIBarButtonItem in IOS Objective C - (void)viewDidLoad { [super viewDidLoad]; UIBarButtonItem *rload=[[UIBarButtonItem alloc]initWithTitle:@"Next" style:UIBarButtonItemStyleBordered target:self action:@selector(R_load)]; [rload setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor greenColor]} forState:UIControlStateNormal]; self.navigationItem.rightBarButtonItem=rload; } -(void)R_load { second *sec=[[second alloc]initWithNibName:@"second" bundle:nil]; [self.navigationController pushViewController:sec animated:YES]; }