Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-15-2011, 11:27 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 24
hey_suburbia is on a distinguished road
Default Display actionSheet from my bar button item causing error.

My project in short:
- I added a Toolbar with a bar button item and set its identifier to "action" in Interface builder.
- In my .h I have: "-(IBAction)shareBtn: (id) sender;"
- In my .m (at top) I have: "#import "SHK.h"
- In my .m I have:
Code:
-(IBAction)shareBtn: (id) sender{

// Create the item to share (in this example, a url)
NSURL *url = [NSURL URLWithString:@"http://getsharekit.com"];
SHKItem *item = [SHKItem URL:url title:@"ShareKit is Awesome!"];

// Get the ShareKit action sheet
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];

// Display the action sheet
[actionSheet showFromToolbar:navigationController.toolbar];

}
I get an error on the last line regarding the navigationController...
Quote:
'navigationController' undeclared (first use in this function)
The IBAction shareButton will open a simple alert (UIAlertView) no problem.
hey_suburbia is offline   Reply With Quote
Old 02-15-2011, 11:36 PM   #2 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

ActionSheet is not the problem. As the error states, navigationController is undeclared. Can't get simpler than that. Is toolbar declared anywhere? would [self toolbar] work instead? If not you need to declare an IBOutlet for the toolbar and connect it in IB.
baja_yu is offline   Reply With Quote
Old 02-16-2011, 08:33 PM   #3 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 24
hey_suburbia is on a distinguished road
Default

Quote:
Originally Posted by baja_yu View Post
ActionSheet is not the problem. As the error states, navigationController is undeclared. Can't get simpler than that. Is toolbar declared anywhere? would [self toolbar] work instead? If not you need to declare an IBOutlet for the toolbar and connect it in IB.
Adding "self" did it:
[actionSheet showFromToolbar:self.navigationController.toolbar];
hey_suburbia is offline   Reply With Quote
Reply

Bookmarks

Tags
actionsheet, navigationcontroller, sharekit, showfromtoolbar

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 371
8 members and 363 guests
chemistry, cpsclicker, jeroenkeij, Kirkout, PavelMik, teebee74, whitey99
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,666
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, cpsclicker
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:05 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0