Monday 29 September 2014

What's new in iOS 8 for user

Recently, Apple launch it's new version of mobile operating system iOS 8. This launch contains a lot of new things for iPhone & iPad user. If you are planing to buy an apple device or simply want to upgrade your existing device, here are some things you need to know about the new operating system.

1. Interactive notiļ¬cations:

In previous iOS version you can only view the notification, just like a text information.You
need to unlock the device or open the app to interact with that notification.

Example: You are getting message notification, then you need to unlock the device to reply it.

In iOS 8 apple make it easier to interact with notification. You can reply the notification without unlocking the device It allow to take action on texts, email, calendar invitations, reminders.
It's not only for apple pre-loaded app, even also for third party app. (like: Facebook, Skype, twitter.)

Now it’s easy to quickly reply to important messages and keep doing what you were doing.






2. Desktop mode in safari:

Some time, when you open a webpage in your mobile device & observe that the web page is little different that  you see it in desktop browser. Some people not like that as it totally different from desktop web site & they prefer the desktop site.

With iOS 8 Apple added desktop mode in safari for such type user. Now user can view the webpage in both mode mobile or desktop according to their preference.

You can use this feature by:
 - Tapping the address field that loaded mobile page
 - Swipe down on the screen below , you will see "Request Desktop Site" button that appears.



3. Enhanced Photo app:

Apple standard pre-loaded Photos app has been updated with better control of light, color alignment,adjustment and cropping.You have no need to edit your photo on desktop or other third party  Photo app. Just click the photo, edit it and share it with your family, friends.

Here are the new features that is added in iOS 8 photo app.

1. Photo library searching
2: Smart suggestions during photo search
3: Smart composition tools.
4: Cropping.
5: Smart adjustment - adjusts exposure, brightness, contrast and more.
6: Filter and other editing tool
7: Adjusts exposure, brightness, contrast, and more.
8: New mode comes to Camera: Time-lapse videos(snapping photos at dynamically selected intervals)




4. Battery Usage:

In iOS 7 apple make the carrier usage by every app available to user. In iOS 8 apple make the user to more interactive about their device status.
In iOS 8 apple make the battery usage by each app avaible to user.

You can see that by going to seeting --> Genral --> Usage --> Battery usage



5. Safari Credit card scanner:

Now a days online shopping is a very common. Suppose you are on online shopping site credit card  entry page & you have to enter the credit card detail manually using the iPhone or iPad keyboard.

It very hectic to enter much information using the device small keyboard & most of us enter 1 or 2 digits wrong in our first attempt.

To reduce the hectic way, apple introduce the new safari credit card scanning feature, Here are the steps to use this feature:

1: Go to online shopping site using safari.
2: Tap on card entry field.
3: You will see a button over keyboard "Scan Credit Card". Tap on it.
4: On tap of it you will see a screen with card frame . Re-position your card in that frame, it will automatically scanned when it properly positioned.

Once scanning finished you card information automatically displayed in required field.




There are some more important features that are still not include in this post. I will describe about them in "What's new in iOS 8 for user (Part -2)".


Wednesday 24 September 2014

Animation from Button center with navigation


 Add an action for that buttons you want view animate from center.
   
@interface FirstViewController : UIViewController
{

}

- (IBAction) btnAction:(UIButton*)sender;

@end

  
Now write a method popUpView in FirstViewControoler implementation 

- (void)popUpView:(UIView*)subView fromPoint:(CGPoint)iconPoint
{

}

In this method we pass the view that we want to animate and center from which we want animation.
Now it times to add some code.

First we change the center of view that we want to animate and add it on view.

    subView.center = iconPoint;
    [self.view addSubview:subView];

 After that we transform it with less scale, so it seems shrinking and zooming during animation.

  subView.transform = CGAffineTransformMakeScale(0.05, 0.05);

Now add an animation with some duration that transform and set the frame of subView with screen bounds.

 [UIView animateWithDuration: 0.4
                          delay: 0
                        options: (UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction)
                     animations:^{
                         subView.transform = CGAffineTransformIdentity;
                                                             subView.frame = [[UIScreen mainScreen] bounds];
                     }
                     completion:^(BOOL finished) {}
     ];


Your method looks like this.

- (void)popUpView:(UIView*)subView fromPoint:(CGPoint)iconPoint
{
    subView.center = iconPoint;
    [self.view addSubview:subView];
   
    subView.transform = CGAffineTransformMakeScale(0.05, 0.05);
    [UIView animateWithDuration: 0.4
                          delay: 0
                        options: (UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction)
                     animations:^{
                         subView.transform = CGAffineTransformIdentity;
                                                             subView.frame = [[UIScreen mainScreen] bounds];
                     }
                     completion:^(BOOL finished) {}
     ];
}

Now  implement some code in btnAction . 
Create an instance of second view controller and initialize a navigation controller with it. We are using navigation controller here so we can move second view to other if needed.

 SecondViewController* secndVC = [[SecondViewController alloc] initWithNibName:@"SecondView" bundle:nil];
 UINavigationController* navC = [[UINavigationController alloc] initWithRootViewController:secndVC];

Now calculate the center point of button with respect to superview.

   CGPoint pt = [sender center];
   CGRect frame = [sender.superview.superview frame];
    pt.y += frame.origin.y;

Pass these pt to the Second View property closeCenter that is used to popView at the button center when user back from that second to first view.

  secndVC.closeCenter = pt;

Now pass these navigation controller view and point to popUpView method that we write above.
And add navigation controller as childViewController for first view controller.

 [self popUpView:navC.view fromPoint:pt];
 [self addChildViewController:navC];

Finally your btnAction is as below:

- (IBAction) btnAction:(UIButton*)sender
{
         SecondViewController* secndVC = [[SecondViewController alloc] initWithNibName:@"SecondView" bundle:nil];
         UINavigationController* navC = [[UINavigationController alloc] initWithRootViewController:secndVC];
         CGPoint pt = [sender center];
         CGRect frame = [sender.superview.superview frame];
         pt.y += frame.origin.y;
    secndVC.closeCenter = pt;
    [self popUpView:navC.view fromPoint:pt];
         [self addChildViewController:navC];
}



 ================ Second View controller ==========


In the SecondViewController add a property CGPoint closeCenter

@property (nonatomic) CGPoint closeCenter;


 Your interface file looks like:

@interface SecondViewController : UIViewController
{

}

@property (nonatomic) CGPoint closeCenter;

@end

Now in SecondViewController Implementation add a barbutton item return.
Add a selector on barButton item.

 UIBarButtonItem* barbt = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonSystemItemCancel target:self action:@selector(returnButton)];

 self.navigationItem.leftBarButtonItem = barbt;


Now add the code for navigate the first view with previous animation in selector method.

First make a CGpoint from property closeCenter.

 CGPoint newCenter = self.closeCenter;

Add animation with scaling and make the center of view as the closeCenter.

   self.view.center = newCenter;
   self.view.transform = CGAffineTransformMakeScale(0.05, 0.05);

After completion of animation remove the view from navigation and navigation controller from parentView.

    [self.navigationController.view removeFromSuperview];
    [self.navigationController removeFromParentViewController];
  

your implementation file looks like this

@implementation SecondViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    UIBarButtonItem* barbt = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonSystemItemCancel target:self action:@selector(returnButton)];

 self.navigationItem.leftBarButtonItem = barbt;
   
}

- (void) returnButton
{
    CGPoint newCenter = self.closeCenter;
   
    [UIView animateWithDuration: 0.4
                          delay: 0
                        options: (UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction)
                     animations:^{
                         self.view.center = newCenter;
                         self.view.transform = CGAffineTransformMakeScale(0.05, 0.05);
                     }
                     completion:^(BOOL finished) {
                         [self.navigationController.view removeFromSuperview];
                                                             [self.navigationController removeFromParentViewController];
                     }
     ];
}

@end




 Now run the project you implement a new animation.