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 08-27-2011, 07:12 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 12
Peak Mobile is on a distinguished road
Default UIActionSheet Button to Open a New View

Hi everyone. I have been struggling for a few days on how to make my UIActionSheet button open a new view. I thought I finally had it with this code, but it is throwing me a bunch of errors. Does anyone have an idea of what I am doing wrong?

I'm trying to open the AboutUs view.


ViewController.h
Code:
-(IBAction)menubutton;
ViewController.m
Code:
#import "AboutUs.h"


//menu button

-(IBAction)menubutton {
    UIActionSheet *menu1 = [[UIActionSheet alloc] initWithTitle:@"Menu" 
    delegate:self 
    cancelButtonTitle:@"Cancel" 
    destructiveButtonTitle:nil 
    otherButtonTitles:@"About Us", @"Submit Idea", nil];
    [menu1 showInView:[self view]];
    [menu1 release];
}

-(void)actionSheet:(UIActionSheet *)menu1 clickedButtonAtIndex:(NSInteger)buttonIndex {
    switch (buttonIndex) {
        case 0: {
            AboutUs *aboutuspage = [[AboutUs alloc] initWithNibName:@"About Us Page" bundle:nil];
            [self presentModalViewController:aboutuspage animated:NO];
            [aboutuspage release]; }
            break;
        case 1:
            //code
            break;
    }
}

//End of Menu Button
The errors I am getting are:
-(3) use of undeclared identifier 'aboutuspage' following the "AboutUs *aboutuspage" line
-instance method '-bundle' not found. (return type defaults to id)
-it says I'm missing a [ between the ininWithNibName: and @"About Us Page:

Last edited by Peak Mobile; 08-28-2011 at 11:55 PM. Reason: fix code
Peak Mobile is offline   Reply With Quote
Old 08-27-2011, 07:48 PM   #2 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

First, please use code tags in the future. [code] [1/CODE] without the 1. Two, what are the errors?
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 08-28-2011, 08:19 AM   #3 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 12
Peak Mobile is on a distinguished road
Default

Quote:
Originally Posted by Domele View Post
First, please use code tags in the future. [code] [1/CODE] without the 1. Two, what are the errors?
I fixed all of the errors by adding a curly bracket around the method for the switch at index 0. Now I don't get any errors, but the app freezes up on the line of code that starts with [self presentmodal....]. It says "Thread 1: Program received signal: SIGABRT".

Any ideas what to do?

Last edited by Peak Mobile; 08-28-2011 at 11:55 PM.
Peak Mobile is offline   Reply With Quote
Reply

Bookmarks

Tags
button, ios, uiactionsheet, view

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: 400
14 members and 386 guests
7twenty7, chiataytuday, cristofercolmbos, dedeys78, fiftysixty, gmarro, iOS.Lover, kilobytedump, Matrix23, raymng, ryantcb, stanny, UMAD, xerohuang
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

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