MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

iOS 7 features and NS Notification coding tips

Published on 03 July 13
504
0
0

Hey Everybody I am Nile Lars I would like to share about Apple iOS7. It has some amazing features. There will also be some coding tips for My Developer Friends.


Itâs really amazing when we use Smartphones and especially when we talk about the iPhone, we say "Oh wow itâs an iPhone!". Using iPhones does not make any sense if we are not aware about its excellent features which are mentioned here :-


Control Center: - This is a feature which provides quick access to your iPhone and when we can also swipe the application.


Notification: - Notification is a feature which helps the user to notify all the incoming alerts and along with it also give the events notification which can be manually set by the user.


Multitasking: - Multitasking is always seen in all types of smart phones but what so special about iPhone is that it gives the time schedule to update the social feeds.


Camera: - Camera is with still, video, panorama, and now square front and center which also include swipe feature which gives flexibility to capture picture the way you want it.


Photos: - Photos are with more memory efficient in this IOS 7 which really helps to capture the good picture along the share location and location tagging.


Airdrop: - Using airdrop, sharing is easier rather than connecting using cables. Airdrop can share documents, images and files with the click of a simple 'share' button.


Safari: - Safari is now more bigger and better to give you the best browsing experience.


ITunes Radio: - iTunes radio provides the various streaming station which you will love to hear and which give amazing radio experience.


Siri: - Siri give more soundly capabilities with various accents and with the gender option of male or female voice to speak that your phone can understand.

The above are some features of the new iOS 7 for your iPhones.

Now here is something for my developer friends.

Taking in account the above feature I am tracing the example of the code for my fellow developers on how they can set the NS Notification code for their development purpose:-

Steps:-

First all you need to do is set you projects

iOS 7 features and NS Notification coding tips - Image 1

All you need to do is to declare the MODEL VIEW CONTROLLER FILE

Then, you need to register the notification

@interface ViewController ()

- (void)postNotificationWithString:(NSString *)orientation;

- (void)useNotificationWithString:(NSNotification*)notification;

@end

Receiving you notification through ViewController than trace the code into viewDidLoad method

NSString *notificationName = @"MTPostNotificationTut";

[[NSNotificationCenter defaultCenter]

addObserver:self

selector:@selector(useNotificationWithString:)

name:notificationName

object:nil];

Posting a Notification

- (void)postNotificationWithString:(NSString *)orientation //post notification method and logic

{

NSString *notificationName = @"MTPostNotificationTut";

NSString *key = @"OrientationStringValue";

NSDictionary *dictionary = [NSDictionary dictionaryWithObject:orientation forKey:key];

[[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:nil userInfo:dictionary];

Making the Function which can override the UIViewController method

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration

{

if (interfaceOrientation == UIInterfaceOrientationPortrait) {

[self postNotificationWithString:@"Portrait"];

}

else {

[self postNotificationWithString:@"Landscape"];

}

}

Type the above code into postNotificationWithString for the "Portrait" or "Landscape" Alignment

Using the Notification

- (void)useNotificationWithString:(NSNotification *)notification //use notification method and logic

{

NSString *key = @"OrientationStringValue";

NSDictionary *dictionary = [notification userInfo];

NSString *stringValueToUse = [dictionary valueForKey:key];

NSLog(@"Device orientation --> %@",stringValueToUse);

}

Tracing the code is not only essential in development, but we always need to make efficient use of memory management. This is exclusively for RAM and Memory purpose with the dealloc method:

- (void)dealloc {

[[NSNotificationCenter defaultCenter] removeObserver:self];

}


And if you are not using automatic referencing than you can use the code

- (void)dealloc {

[[NSNotificationCenter defaultCenter] removeObserver:self];

[super dealloc];

}

The above is a simple code example for NSNOTIFICATION for my developer friends.


Nile Lars works at a leading IT consulting and Services Company that provides high-end software services to enterprise mobile application development for their mobile and web development needs.





















Hey Everybody I am Nile Lars I would like to share about Apple iOS7. It has some amazing features. There will also be some coding tips for My Developer Friends.

Itâs really amazing when we use Smartphones and especially when we talk about the iPhone, we say "Oh wow itâs an iPhone!". Using iPhones does not make any sense if we are not aware about its excellent features which are mentioned here :-

Control Center: - This is a feature which provides quick access to your iPhone and when we can also swipe the application.

Notification: - Notification is a feature which helps the user to notify all the incoming alerts and along with it also give the events notification which can be manually set by the user.

Multitasking: - Multitasking is always seen in all types of smart phones but what so special about iPhone is that it gives the time schedule to update the social feeds.

Camera: - Camera is with still, video, panorama, and now square front and center which also include swipe feature which gives flexibility to capture picture the way you want it.

Photos: - Photos are with more memory efficient in this IOS 7 which really helps to capture the good picture along the share location and location tagging.

Airdrop: - Using airdrop, sharing is easier rather than connecting using cables. Airdrop can share documents, images and files with the click of a simple 'share' button.

Safari: - Safari is now more bigger and better to give you the best browsing experience.

ITunes Radio: - iTunes radio provides the various streaming station which you will love to hear and which give amazing radio experience.

Siri: - Siri give more soundly capabilities with various accents and with the gender option of male or female voice to speak that your phone can understand.

The above are some features of the new iOS 7 for your iPhones.

Now here is something for my developer friends.

Taking in account the above feature I am tracing the example of the code for my fellow developers on how they can set the NS Notification code for their development purpose:-

Steps:-

First all you need to do is set you projects

iOS 7 features and NS Notification coding tips - Image 1

All you need to do is to declare the MODEL VIEW CONTROLLER FILE

Then, you need to register the notification

@interface ViewController ()

- (void)postNotificationWithString:(NSString *)orientation;

- (void)useNotificationWithString:(NSNotification*)notification;

@end

Receiving you notification through ViewController than trace the code into viewDidLoad method

NSString *notificationName = @"MTPostNotificationTut";

[[NSNotificationCenter defaultCenter]

addObserver:self

selector:@selector(useNotificationWithString:)

name:notificationName

object:nil];

Posting a Notification

- (void)postNotificationWithString:(NSString *)orientation //post notification method and logic

{

NSString *notificationName = @"MTPostNotificationTut";

NSString *key = @"OrientationStringValue";

NSDictionary *dictionary = [NSDictionary dictionaryWithObject:orientation forKey:key];

[[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:nil userInfo:dictionary];

Making the Function which can override the UIViewController method

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration

{

if (interfaceOrientation == UIInterfaceOrientationPortrait) {

[self postNotificationWithString:@"Portrait"];

}

else {

[self postNotificationWithString:@"Landscape"];

}

}

Type the above code into postNotificationWithString for the "Portrait" or "Landscape" Alignment

Using the Notification

- (void)useNotificationWithString:(NSNotification *)notification //use notification method and logic

{

NSString *key = @"OrientationStringValue";

NSDictionary *dictionary = [notification userInfo];

NSString *stringValueToUse = [dictionary valueForKey:key];

NSLog(@"Device orientation --> %@",stringValueToUse);

}

Tracing the code is not only essential in development, but we always need to make efficient use of memory management. This is exclusively for RAM and Memory purpose with the dealloc method:

- (void)dealloc {

[[NSNotificationCenter defaultCenter] removeObserver:self];

}

And if you are not using automatic referencing than you can use the code

- (void)dealloc {

[[NSNotificationCenter defaultCenter] removeObserver:self];

[super dealloc];

}

The above is a simple code example for NSNOTIFICATION for my developer friends.

Nile Lars works at a leading IT consulting and Services Company that provides high-end software services to enterprise mobile application development for their mobile and web development needs.

This blog is listed under Development & Implementations , Operating Systems and Mobility Community

Post a Comment

Please notify me the replies via email.

Important:
  • We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
You may also be interested in
Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top