Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

Wednesday, 7 August 2013

How to get user's current location in your app (iOS programming)

To get current location in iOS:

---> #import <coreLocation/coreLocation.h>
1- Create an instance of CLLocationManager
2- Assign a delegate to the CLLocationManager object
3- Set desiredAccuracy & distanceFilter
4- Call startUpdatingLocation
5- locationManager reports the event to this method ---> locationManager:didUpdateLocations (iOS 6 & Later)


Sample Code:


-----> .h File
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

@interface infinityViewController : UIViewController <CLLocationManagerDelegate>{

    CLLocationManager *locationManager;
}
@end

----> .m File

#import "infinityViewController.h"


@interface infinityViewController ()


@end



@implementation infinityViewController


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

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)getCurrentLocation

{
   
    if (locationManager == nil  )
       
        locationManager = [[CLLocationManager alloc] init];
   
   
   
    locationManager.delegate = self;
   
    locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;

   
    locationManager.distanceFilter = 400;
   
   
   
    [locationManager startUpdatingLocation];
   
}


- (void)locationManager:(CLLocationManager *)manager

     didUpdateLocations:(NSArray *)locations {
       
    CLLocation* currentLocation = [locations lastObject];
   
    NSDate* eventDate = currentLocation.timestamp;
   
    NSTimeInterval howRecent = [eventDate timeIntervalSinceNow];
   
    if (abs(howRecent) < 20.0) {
       
       
        NSLog(@"Latitude Value: %+.6f\n",currentLocation.coordinate.latitude);
                   
        NSLog(@"Longitude Value %+.6f\n",currentLocation.coordinate.longitude);
       
    }
   
}

@end

written by: infinitywebseo 

Wednesday, 12 June 2013

iOS 7 --> Things that you need to change about your app

 
All the contents on this blog are derived from apple developer website, its just a quick short-list for my own personal use.  I hope you find it useful.


Things I must do:
  • Update app icon to 120 x 120 (iOS 7 - Higher Resolution).
  • Update the launch image to include the status bar area.
  • Support Retina display.


Things I should do:  
Prepare for borderless buttons by moving away from supplying button background images and by reassessing your layout.

Use translucent UI Element & Auto-layout.

View controllers should use full screen layout. Don't use "wantsFullScreenLayout", its deprecated in iOS 7. Instead use the following properties:
  • edgeForExtendedLayout
  • extendedLayoutIncludeOpaqueBars
  • automaticalAdjustScrollViewInsets

For custom animated transitions between views click on --> UIViewControllerInteractiveTransitioning Protocol Reference. 


Using tint color: In iOS 7 tint is a property of UIView. Specify a tint color for entire app using following line: window.tintColor = [UIColor purpleColor]; By default tint color is nil which means that it uses the parent tint color. 
Remember, its best to change tint color when the app is off screen.


Bars and Bar Buttons barPosition in iOS 7 is a property for identifying bar position. The UIBarPositionTopAttached -----> a bar is at the top of the screen and its background extends upward into the status bar area. 
UIBarPositionTop ------> a bar is at the top of its local context—for example, at the top of a popover—and that it doesn’t provide a background for the status bar. 


Status Bar iOS 7
In iOS 7 You can control the style of the status bar from an individual view controller and change it while the app runs. In order to do it, add the UIViewControllerBasedStatusAppearance key to an app's Info.plist file and give it the value YES.


Navigation Bar iOS 7
Bar Style: by default the translucent property is YES.
Appearance: A one-pixel hairline appears a the button edge.  
Tinting: Use tintColor to tint bar button items.
             Use barTintColor to tint the bar background.


Collection View iOS 7
Collection view supports animated transitions between layouts. Click to read the documentation ------> UICollectionViewTransitionLayout Class Reference

Image View iOS 7
UI Image contains tintColor property and when image uses UIImageRenderingModeAlwaysTemplate mode, tintColor is applied to the image.

Map View iOS 7
In iOS 7 there is a new class called MKOverlayRenderer which you can use to create overlay on the top of map view.


Page View Controller iOS 7
To specify orientation use the following methods:
  • pageViewControllerPreferredInterfaceOrientationForPresentation
  • pageViewControllerSupportedInterfaceOrientations 
Scrol View in iOS 7  
automaticallyAdjustsScrollViewInsets ----> to manage scroll view insets.

written by: infinitywebseo 

 

 


Debt Collection

Debt Collectors