Showing posts with label developer. Show all posts
Showing posts with label developer. Show all posts

Friday, 17 October 2014

App Extensions Increase Your Impact




Starting in iOS 8.0 and OS X v10.10, an app extension lets you extend custom functionality and content beyond your app and make it available to users while they’re using other apps or the system. You create an app extension to enable a specific task; after users get your extension, they can use it to perform that task in a variety of contexts. For example, if you provide an extension that enables sharing to your social sharing website, users can use it to post a remark while surfing the web. Or if you provide an extension that displays current sports scores, users can put it in Notification Center so that they can get the latest scores when they open the Today view. You can even create an extension that provides a custom keyboard that users can use in place of the iOS system keyboard.

There Are Several Types of App Extensions

iOS and OS X define several types of app extensions, each of which is tied to an area of the system, such as sharing, Notification Center, and the iOS keyboard. A system area that supports extensions is called an extension point. Each extension point defines usage policies and provides APIs that you use when you create an extension for that area. You choose an extension point to use based on the functionality you want to provide.

Table 1-1 lists the extension points in iOS and OS X and gives an example of tasks you might enable in an app extension for each extension point.

Table 1-1Extension points in iOS and OS X
Extension point
Typical app extension functionality
Today (iOS and OS X)
Get a quick update or perform a quick task in the Today view of Notification Center
(A Today extension is called a widget)
Share (iOS and OS X)
Post to a sharing website or share content with others
Action (iOS and OS X; UI and non-UI variants)
Manipulate or view content originating in a host app
Photo Editing (iOS)
Edit a photo or video within the Photos app
Finder Sync (OS X)
Present information about file sync state directly in Finder.
Document Provider (iOS; UI and non-UI variants)
Provide access to and manage a repository of files.
Custom Keyboard (iOS)
Replace the iOS system keyboard with a custom keyboard for use in all apps
Because the system defines specific areas for app extensions, it’s important to choose the area that best matches the functionality you want to deliver. For example, if you want to create an extension that enables a sharing experience, use the Share extension point, starting with the Share Extension Xcode template.

IMPORTANT

Each app extension you create matches exactly one of the extension points listed in Table 1-1. You don’t create a generic extension that matches more than one extension point.

Xcode and the App Store Help You Create and Deliver App Extensions

An app extension is different from an app. Although you must use an app to contain and deliver your extensions, each extension is a separate binary that runs independent of the app used to deliver it.

You create an app extension by adding a new target to an app. As with any target, an extension target specifies settings and files that combine to build a product within your app project. You can add multiple extension targets to a single app (an app that contains one or more extensions is called a containing app).

The best way to start developing an app extension is to use one of the templates that Xcode provides for each extension point on both platforms. Each template includes extension point–specific implementation files and settings, and produces a separate binary that gets added to your containing app’s bundle.

To distribute app extensions to users, you submit a containing app to the App Store. When a user installs your containing app, the extensions it contains are also installed.

After installing an app extension, a user must take action to enable it. Often, users can enable an extension within the context of their current task. If your extension is a Today widget, for example, users can edit the Today view in Notification Center to enable your extension. In other cases, users can use Settings (in iOS) or System Preferences (in OS X) to enable and manage the extensions they install.

Users Experience App Extensions in Different Contexts

Although each type of app extension enables a different type of task, there are some parts of the user experience that are common to most extensions. As you think about designing an extension, it’s important to understand the user experience that’s intended by the extension point you choose. At a high level, the best user experience for all extensions is quick, streamlined, and focused on a single task.

Users open your app extension by interacting with some system-provided user interface (UI). For example, a user accesses a Share extension by activating the system-provided Share button in an app and choosing the extension from the list that’s displayed.

Although most app extensions provide at least some custom UI elements, users don’t see your custom UI until they enter your extension. When users enter your extension, your custom UI can help to show them that they’re shifting into a new context. Because users can distinguish your extension from the current app, they can appreciate the unique functionality that you provide. Users’ awareness of extensions as separate entities also means that they can identify and remove extensions that misbehave or don’t perform well.

To give users a smooth transition into your app extension, you generally want to balance your custom design with the UI that’s associated with the extension point. For example, it’s a good idea to make your widget look like it belongs in the Today view. Similarly, in your Photo Editing extension, it works well to create a UI that harmonizes with Photos in iOS.

NOTE

Even if your app extension doesn’t display any custom UI (other than an icon), users still understand that your extension is different from the current app because they took a specific action to activate it.

Source:  https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/index.html

Wednesday, 5 March 2014

Setting custom UITableViewCells height

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 30;
}






 

How to change font size of a row in tableview (iOS Developer)

    cell.textLabel.font = [UIFont systemFontOfSize:12];

Tuesday, 4 March 2014

UITableView with Multiple Sections


 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
      return 2 ;
 }

 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
      if (section==0)
      {
             return [array1 count];
      }
      else{
             return [array2 count];
      }
 }

 - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {

 if(section == 0)
      return @"Section 1";
 if(section == 1)
      return @"Section 2";
 }

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{

      static NSString *CellIdentifier = @"Cell";

      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
     if (cell == nil) {
      cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
      }

 if (indexPath.section==0) {
     ObjectData *theCellData = [array1 objectAtIndex:indexPath.row];

Monday, 3 March 2014

Using fontawesome for objective-C iOS Developer

If you like to use fontawesome in your objective C App, I have find a perfect project on github, this is the link:

https://github.com/alexdrone/ios-fontawesome


FontAwesome+iOS

Font awesome is an iconic font. Read more about it on http://fortawesome.github.com/Font-Awesome/
This category brings this great iconic font on iOS.

Usage

First, make sure you have FontAwesome.ttf bundled in your project and that UIAppFonts key in the project's plist file contains a String item named FontAwesome.ttf Then add the NSString+FontAwesome category to the project.
UILabel *label = [...]
label.font = [UIFont fontWithName:kFontAwesomeFamilyName size:20];
You can now use enums for all the different iconic characters
label.text = [NSString fontAwesomeIconStringForEnum:FAGithub];
or you can reference them by using the class identifiers listed here http://fortawesome.github.com/Font-Awesome/#all-icons
label.text = [NSString fontAwesomeIconStringForIconIdentifier:@"fa-github"];
That's it! For further information have a look to the small demo project!

FAImageView

FAImageView is now extended and contains a new property called defaultView that is shown when the image is set to nil. It is possible to use one the font-awesome icon as a default placeholder for an image view.
FAImageView *imageView = [[FAImageView alloc] initWithFrame:CGRectMake(0.f, 0.f, 100.f, 100.f)];
imageView.image = nil;
[imageView setDefaultIconIdentifier:@"fa-github"];

License

This project uses the FontAwesome fix made by Pit Garbe that you can find at https://github.com/leberwurstsaft/FontAwesome-for-iOS Version 2.0 of the Font Awesome font, CSS, and LESS files are licensed under CC BY 3.0: http://creativecommons.org/licenses/by/3.0/ A mention of 'Font Awesome - http://fortawesome.github.com/Font-Awesome' in human-readable source code is considered acceptable attribution (most common on the web). If human readable source code is not available to the end user, a mention in an 'About' or 'Credits' screen is considered acceptable (most common in desktop or mobile software)

UIFont Class Reference

Overview

The UIFont class provides the interface for getting and setting font information. The class provides you with access to the font’s characteristics and also provides the system with access to the font’s glyph information, which is used during layout. You use font objects by passing them to methods that accept them as a parameter.
You do not create UIFont objects using the alloc and init methods. Instead, you use class methods of UIFont, such as preferredFontForTextStyle:, to look up and retrieve the desired font object. These methods check for an existing font object with the specified characteristics and return it if it exists. Otherwise, they create a new font object based on the desired font characteristics.
Font objects are immutable and so it is safe to use them from multiple threads in your app.

Read more: https://developer.apple.com/library/ios/documentation/uikit/reference/UIFont_Class/Reference/Reference.html

Sunday, 2 March 2014

Setup font for the whole app - iOS Developer

 Article Source Link: http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/

Step 1: Include your fonts in your XCode project
Most commonly, you’ll have a TTF or OTF font that you’ll want to use with all of your UILabels or UITextViews in your app. Well, the first step is to include these fonts into your XCode project.

I commonly keep all of my app resources such as images or fonts in their own directory called “Resources”. I find that this helps me stay organized as projects get much more complex and there are a lot of files. Whatever your case may be, either drag and drop your font file(s) into your XCode file tree or right click and “Add Files To…” to select your fonts.

Adding Custom Fonts to XCode Dialog Box
Make sure that the target you want to use your font in is checked!


Step 2: Make sure that they’re included in the target
The next thing to do is to make sure that they’re resources and included in your build target that you want to use the fonts in.

Checking That Your Custom Font Is Included In Your Target
Make sure that the target you want to use your font in is checked under “Target Membership”


Step 3: Double check that your fonts are included as Resources in your bundle
This should not be a problem but sometimes when you’re having trouble getting your font face to show up, this can be a source of headache so let’s double check now to rule it out as a potential pitfall.

this can be a source of headache

Go to your project Build Phases pane by highlighting the XCode project file in your solution explorer and on the right hand side, select “Build Phases”. You’ll see that one of the sections you can expand is “Copy Bundle Resources”. Open that list and make sure that your fonts are included in that list.

Checking That Your iOS Custom Font Is a Resource In The Bundle
Ensure that your fonts are in the “Copy Bundle Resources” list


Step 4: Include your iOS custom fonts in your application plist
The next thing to do is to modify your app’s plist to include these font faces. By default, your plist will be named something like [appname]-Info.plist and will reside in the “Supporting Files” folder if you haven’t moved it.

Open it and add a new row called “Fonts provided by application” which will be an array that you need to add all the filenames of the fonts you want to use. In my case, it was three of the Neutraface 2 Display fonts as you can see in the screenshot below. Be careful to include the extension and make sure that you don’t perform any typos here. That’s another common problem, as simple as it may seem.

Adding Your Custom iOS Fonts To Your App Plist
See the above screenshot on the key that you need to add, followed by the filenames of the fonts you want to include in your iOS app

…make sure that you don’t perform any typos here. That’s another common problem


Step 5: Find the name of the font
This is a common pitfall for many people trying to include custom fonts into their iOS app. This was something that eluded me before as well and it’s the fact that when you specify which font you want to use, you’re not specifying the file name but rather, the font name. The tricky part is that the font name may not be what you expect. It could be very different than any of the visible font names that you can see.

So in order to easily find the name of the font that you want to use, you can output something to the console window and see for yourself.

The tricky part is that the font name may not be what you expect

Add this snippet of code to log all the fonts available to your app in the console.

1
2
3
4
5
6
7
8
9
for (NSString* family in [UIFont familyNames])
{
    NSLog(@"%@", family);
       
    for (NSString* name in [UIFont fontNamesForFamilyName: family])
    {
        NSLog(@"  %@", name);
    }
}
Once you run your app, you’ll get the list of fonts displayed in your console log. Then its just a matter of finding your custom font in the list and getting the font names.

Finding The Font Names For Your Custom Fonts
Logging all fonts and finding the font names for your custom font

In the screenshot above, as you can see the font name I needed was Neutraface2Display-Bold. This font name was no where to be found in the font properties or from the OSX font viewer. Remember to get rid of that code snippet after you find the font name that you need!


Step 6: Use UIFont and specify the name of the font
And finally, you can simply display your custom font using UIFont and whatever UILabel or text view you want.

1
2
3
4
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 60)];
label.textAlignment = NSTextAlignmentCenter;
label.text = @"Using Custom Fonts";
label.font = [UIFont fontWithName:@"Neutraface2Display-Titling" size:20];
Sample of Displaying The Custom Font in the iOS Simulator
Sample of using custom fonts in your iOS App!

Tuesday, 25 February 2014

View Controller Transitions iOS7


If you like to learn about animatedtransitioning this is the best blog that I have find, explains it very well: http://www.objc.io/issue-5/view-controller-transitions.html


View Controller Transitions
Issue #5 iOS 7, October 2013
By Chris Eidhof

One of the most exciting iOS 7 features for me is the new View Controller Transitioning API. Before iOS 7, I would also create custom transitions between view controllers, but doing this was not really supported, and a bit painful. Making those transitions interactive, however, was harder.

Before we continue with the article, I’d like to issue a warning: this is a very new API, and while we normally try to write about best practices, there are no clear best practices yet. It’ll probably take a few months, at least, to figure them out. This article is not so much a recommendation of best practices, but rather an exploration of a new feature. Please contact us if you find out better ways of using this API, so we can update this article.

Before we look at the API, note how the default behavior of navigation controllers in iOS 7 changed: the animation between two view controllers in a navigation controller looks slightly different, and it is interactive. For example, to pop a view controller, you can now pan from the left edge of the screen and interactively drag the current view controller to the right.

That said, let’s have a look at the API. What I found interesting is the heavy use of protocols and not concrete objects. While it felt a bit weird at first, I prefer this kind of API. It gives us as programmers much more flexibility. First, let’s try to do a very simple thing: having a custom animation when pushing a view controller in a navigation controller (the sample project for this article is on github). To do this, we have to implement one of the new UINavigationControllerDelegate methods:

- (id<UIViewControllerAnimatedTransitioning>)
                   navigationController:(UINavigationController *)navigationController
        animationControllerForOperation:(UINavigationControllerOperation)operation
                     fromViewController:(UIViewController*)fromVC
                       toViewController:(UIViewController*)toVC
{
    if (operation == UINavigationControllerOperationPush) {
        return self.animator;
    }
    return nil;
}

Read the rest of the article here : http://www.objc.io/issue-5/view-controller-transitions.html



Sunday, 29 September 2013

Designing app for iOS 7

Deference, clarity and depth are the main themes for iOS 7 development. Focus on core functionalities and content and keep the design simple.

Provide clarity:
  1. Use plenty of negative space, negative space make important content more noticeable. 
  2. Let color simplify the UI.
  3. Ensure legibility by using the system fonts. 
  4. Embrace borderless buttons.   

Content is at the heart of iOS 7: 
  1. Take advantage of the whole screen, let content extend to the edges.
  2. Reconsider visual indicators of physicality and realism, avoid heavy UI elements, keep it simple, focus on content and let the UI have the supporting role. 
  3. Let translucent UI elements hint at the content behind them.



Monday, 2 September 2013

REQUEST_DENIED when using the Google Places API


<PlaceSearchResponse>
  <status>REQUEST_DENIED</status>
</PlaceSearchResponse>

I had this problem for a while, and could not find any solution for it on the web. But I did manage to sort it out, if you need a quick fix do the following:

In google api console when creating your key, I chose the server and left the field blank so it allows any IP. Now my api key works perfectly fine.

Key for server apps (with IP locking)
API key:
your api key
IPs:
Any IP allowed
Activated on:  date
Activated by:  you

I did the same for my ios key now it works on all of my ios apps.

Monday, 1 July 2013

What is autoreleasepool?

@autoreleasepool {

 return UIApplicationMain(argc, argv, nil, NSStringFromClass([yourAppNameAppDelegate class]));

}

Basically autoreleasepool supports automatic reference counting, which provides automatic object-life time management for your iOS application.

In simple words it just makes sure that objects are around as long as they are needed in your app and not longer.

written by: infinitywebseo 

Wednesday, 26 June 2013

How to create iCloud entitlements file manually?

Creating entitlements file manually is very simple, open the text editor and just copy and paste the following lines of code: (save it as <yourappname>.entitlements)

<?xml version="1.0" encoding="UTF-8">
<!DOCTYPE plist PUBIC "-//Apple//DTD PLIST" 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>apple.developer.ubiquity-container-identifiers</key>

<array>
<string>$(TeamIdentifierPrefix).com.yourdomain.icloudapp</string>
</array>

<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$($(TeamIdentifierPrefix).com.yourdomain.icloudapp)</string>

</dict>
</plist>

After saving you file simply drag and drop it to your app on xcode.

written by: infinitywebseo 

Monday, 24 June 2013

UIDocument does not allow you to write strings directly to disk

If you are using UIDocument in your app, always remember that UIDocument doesn't allow you to write strings directly to disk.

You need to package the string value in NSData then you can write it to disk. You can do it using the contentsForType:error method.

Below is a sample code, first check that the string is not NULL :

- (id)contentsForType:(NSString *)typeName error:(NSError **) myError{
    if (!self.stringDocument)
        self.stringDocument = @"";

    NSData *nsDataDocument = [self.stringDocument
                           dataUsingEncoding:NSUTF8StringEncoding];
    return nsDataDocument;
}

written by: infinitywebseo 

Wednesday, 19 June 2013

How to Check iCloud is available in your app?

After enabling icloud on your app, just copy and paste the highlighted lines of code to your appdelegate.m to check that icloud is available for your app:

- (void)initializeiCloudAccess {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        if ([[NSFileManager defaultManager]
             URLForUbiquityContainerIdentifier:nil] != nil)
            NSLog(@"iCloud is available\n");
        else
            NSLog(@"iCloud is not available.\n");
    });
}


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   
    [self initializeiCloudAccess];

    return YES;
}

The executable was signed with invalid entitlements. (0xE8008016)


Summary: if you have this error --> Try creating your new provisional profile through xcode > organiser it may solve the problem. (Don't create it trough your developer account on-line)

I had this error when I tried to run an app that uses icloud on an ios device. For icloud application you must create an app id  and new provisional profile.

What I did was that I create my new provisional trough my apple developer account website. Even thought I refreshed my provisional profile on xcode > organiser, I couldn't get rid of the error,  never mind few hours of searching on the web trying to find out the answer which was unsuccessful.


At the end, I just deleted my app id, and provisional profile. Then I create  a new app id, and this time I create my provisional profile through xcode > organiser, run my app again and it just worked.

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

Sunday, 12 May 2013

How to add tweet button to iOS app?

iOS includes a framework that you can use to add twitter to your iOS application. Follow the link below to see the full documentation:


What can I do with the framework?

  1. Single Sign-On
  2. Distribution
  3. Instant Personalization


written by: infinitywebseo 

Tuesday, 30 April 2013

What is NSUserDefaults? (iOS)

Grand Central Dispatch (GCD) is a C API.  The basic idea is that you have queues of operations, which are specified using blocks. The blocks in the queue run in another thread except main thread.

There are two types of queues.  Serial Queues and Concurrent Queues
In serial queues blocks are executed in order. (one by one)

When do we use Multi-threading:

Accessing the network
Big calculation, hugs loines of code


Creating and releasing queues:
dispatch_queue_t dishpatch_queue_create(const char *label, NULL); // Null means serial queue

Putting blocks in the queue:
typedef void (^dispatch_block_t)(void);
void dispatch_async(dispatch_queue_t queue, dispatch_block_t block); //it puts the block in the queue then returns to main thread immediately

void dispatch_sync(dispatch_queue_t queue, dispatch_block_t block);  // puts the block in the queue and waits until the block finally gets to run to compelition and get backs to current thread

Getting the current or main queue
dispatch_queue_t dispatch_get_current_queue();
dispatch_queue_t dispatch_get_main_queue();


written by: infinitywebseo