Posts Tagged ‘Example’
Using ShareKit For Twitter Sharing Only
Example iOS project for iOS using both ShareKit to share a tweet from your application preceeded by a fixed hashtag. The example is using xAuth authentication which requires approval from Twitter.
Steps to create the project:
- Download the lastest version of ShareKit
- Create a project based on the Windows template
- Add the ShareKit folder to your project
- Add the ShareKit button to the navigation bar and add the code to UIViewController for ShareKit (See example code)
- Modify the Twitter section of the SHKConfig.h file. Depending on using oAuth or xAuth you need to make different changes
- Modify the application section of the SHKConfig.h file. I did configure #define SHKMyAppName @”Verkeersles” and #define SHKMyAppURL @”http://www.noorselijster19.com”, you should use your own settings
- To see the standard behaviour build and run the project
- Modify the SHKActionSheet.m file to remove the standard MORE button from the UIActionSheet and the related behaviour
- Modify the SHK.m file to change the accepted types of sharing for text (SHKShareTypeText) e.g. only allow Twitter sharing
- I did remove the Tumblr mail option from the SHKSharers.plist
Now build and run the project
Download the example for TwitterWithHashTags here…
Combine TabBar and SplitView
Example iOS project for iPad using both TabBar and the SplitView Controller.
Steps to create the project:
- Create project using the SplitViewController project template
- Create project using the TabBar project template
- Copy the RootViewController.* and DetailedViewController.* files from the SplitViewController project into the TabBar project
- I renamed the DetailedViewController.* files into ThirdViewController.*
- Open the MainWindow.xib of the TabBar project and add the third tab, the connection to the ThirdViewController will be handled in the code
- Apply the necessary changes to the SplitViewController application delegate files (see the example project)
- Add the makeSplitViewController method to initialize and connect the SplitViewController to the third tab
- Add the methods to handle showing and hiding the SplitViewController button in the navigation bar. These methods are called at several places e.g. when the TabBar is clicked, for the SplitViewController the orientation is checked and if necessary the button is hidden/shown
Now build and run the project
Updated May 5th, 2011: The example project is based on the article written by Mark Zangfound found on the iPhone Dev SDK forum. In addition I used some stuff from Greg Combs to handle rotation correctly. This code example is provided as the forum provides no sample and the discussion could confuse some programmers. I think an example tells a lot more and can be studied.
Download the example for TabBarWithSplitView testend with XCODE 4.3 here…
Localize Using User Defined Language
Example iOS project displaying text in English (default) or Dutch depending on the user defined language settings.
The first time the application will use the English language. The user can switch between English and Dutch using the segmented control. The selected language is persisted in NSUserDefaults and used the next time to initialize the language after loading the application.
The example uses the localized information stored in localized strings file. The localized information is retrieved using NSLocalizedString method.
Download the example for UserDefinedLocalization here…
Localized FAQ with Search capability
Example iOS project displaying FAQ in English (default) or Dutch depending on the iPhone international settings.
The example uses both the localized information stored in Core Data. The attribute names are also localized to retrieve the information using NSLocalizedString method.
After initial startup “Press +” to populate the database.
The application lists the FAQ categories and the detailed overview shows the FAQ for a specific category. Each FAQ contains a question presented in the Section Header and the answer is presented in the first Section Row. The question can be selected by touching the Section Header, the related Section Row expands and the Section Row for the previous selected questions will collapse.
The application offers the possibility to search for FAQ matching particular strings. When the searchbar is clicked the keyboard appears and the cancel button is added.
The cancel button clears the searchbar and initializes the results. Clicking the search button queries the Core Data database using the seachbar text as predicate.
Download the example for LocalizedFAQ here…
Localized Plist
Small example iOS project displaying the country name in English (default) or Dutch depending on the iPhone international settings.
The example uses both the localized strings file and the localized plist.
Download the example for LocalizedPlist here…