![]() ![]() (id)initWithConnectionString:(NSString*)listenConnectionString HubName:(NSString*)hubName Copy the following code in the interface section of the file Notifications.h: NSData* deviceToken In the assistant editor, create outlets for all the switches and call them "WorldSwitch", "PoliticsSwitch", "BusinessSwitch", "TechnologySwitch", "ScienceSwitch", "SportsSwitch"Ĭreate an Action for your button called subscribe your ViewController.h should contain the following code: (weak, nonatomic) IBOutlet UISwitch (weak, nonatomic) IBOutlet UISwitch (weak, nonatomic) IBOutlet UISwitch (weak, nonatomic) IBOutlet UISwitch (weak, nonatomic) IBOutlet UISwitch (weak, nonatomic) IBOutlet UISwitch *SportsSwitch Ĭreate a new Cocoa Touch Class called Notifications. Six switches, one per category, set each switch State to be Off by default. Labels with category texts "World", "Politics", "Business", "Technology", "Science", "Sports", In your MainStoryboard_iPhone.storyboard add the following components from the object library: When the app starts, a device registration is created in your notification hub with the selected categories as tags. The categories selected by a user are stored on the device. The first step is to add the UI elements to your existing storyboard that enable the user to select categories to register. Before starting this tutorial, you must have already completed Tutorial: Push notifications to iOS apps using Azure Notification Hubs. Once the user selects a feed from the side menu we need to update the main view.This topic builds on the app you created in Tutorial: Push notifications to iOS apps using Azure Notification Hubs. So far we are almost done, let’s finish it up with the view for our articles! Loading Feed Data and Showing Articles Below the list is a button to add new feeds, which will then bring up the alert view. ![]() The rest of the view defines the actual content of the side menu, where we display a list of our feeds and assign click events to each of them. We will see how to handle these params in the next section.īefore we come to that we need to show the list of feeds inside our side menu view, so go ahead and open the src/pages/home/home.html: Recent articles Īt the bottom we define our navigation where the root is set to the variable rootPage. If the user selects a feed we set the root of our navigation to the FeedListPage and pass the selected feed object as a parameter. Inside the handler for the result of this alert we can catch the user input and create (add) a new feed again just by using our service and calling a reload on the view to update the list. The actual longer part is to add a feed, which is simply displaying an Alert with 2 inout fields for the URL and a clear name for the Feed. We use the ionViewWillEnter to load the feeds from our service, and if we have the data we simply assign it to the this.feeds variable which will be used in our view in the next step. Note: The default created HomePage is not ready for lazy loading so we delete it and create it again - then it will have a module file!Īs we will also use Ionic Storage, we need to import it and our provider into our module as well as the HttpModule to make some requests, so replace everything inside src/app/ with: import Npm install -save cordova plugin add cordova-sqlite-storage Ionic cordova plugin add cordova-plugin-inappbrowser Now go ahead and run from your command line: ionic start devdactic-rss blank We also install a Cordova plugin to open a browser inside the app and also the SQLite storage which will be used by Ionic Storage where we will store data. Additional we generate a page and a provider for our app which we can easily use later for our reader. Join the Ionic Academy Starting a new Ionic 2 AppĪs always, we use the Ionic CLI to start a blank new Ionic app. If you want to learn Ionic with step-by-step video courses, hands-on training projects and a helpful community who has your back, then take a look at the Ionic Academy. Is learning from tutorials and videos sometimes not enough for you? Then I got something for you. Learning Ionic can become overwhelming, I know that feeling. Let’s dig into the fun and start a blank new app! Prerequisite I give credits to Raymond Camden where I first saw the Yahoo API in action, so follow him, he’s an awesome guy who likes Star Wars and cats. Within this post we will build a simple RSS reader with Ionic 2 using the Yahoo API to transform our feeds into more readable JSON. Parsing RSS data is not a simple task given that most feeds are based on XML. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |