![]() The class is also going to act as the transaction observer and products request delegate so this fact is declared. (void)getProductInfo:(UIViewController the class will use the Store Kit Framework, the file has also been imported. ![]() #import PurchaseViewController : (strong, nonatomic) SKProduct (strong, nonatomic) NSString (strong, nonatomic) IBOutlet UILabel (strong, nonatomic) IBOutlet UIButton (strong, nonatomic) IBOutlet UITextView *productDescription Locate and select the PurchaseViewController.h file, verify the outlets and action are correctly implemented, then add additional properties and declarations that will be needed later in the chapter: #import Next, establish an Action connection from the Buy button to a method named buyProduct. ![]() Using the Assistant Editor with the PurchaseViewController.h file selected, establish outlets for the label, text view and button named productTitle, productDescription and buyButton respectively. Also remove the sample Latin text from the text view object using the Attributes Inspector. Select the button object and stretch it so that it is approximately half the overall width of the containing view. The completed storyboard should appear as shown in Figure 86-2. This will ensure that the button is disabled until the user has purchased access to level 2. Release the line and select push from the resulting menu.įinally, select the “Enter Level 2” button, display the Attributes Inspector and turn off the Enabled checkbox in the Control section. Add a label to the view of the new scene and change the label’s text to ”Welcome to Level 2”.Įstablish a segue from the “Enter Level 2” button to the Level 2 scene by Ctrl clicking and dragging from the button to the new scene. (strong, nonatomic) IBOutlet UIButton another scene to the storyboard by dragging and dropping a View Controller object from the Object Library onto the canvas. #import InAppDemoViewController : UIViewController On completion of these steps, the InAppDemoViewController.h file should read as follows: #import Also establish an Outlet connection for the “Enter Level 2” button named level2Button. Using the Assistant Editor with the InAppDemoViewController.h file selected, establish an Action connection from the “Buy Level 2 Access” button to an action method named purchaseItem. Next, design the user interface for the Level 1 screen as illustrated in the far left view of Figure 86-1. Load the InAppDemo project into Xcode, select the Main.storyboard file, select the In App Demo View Controller scene and choose the Editor -> Embed In -> Navigation Controller menu option to add a navigation controller to the storyboard.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |