What am I doing wrong? Switch Views??

I am writing an application for the iphone. To start, I created a View-Based Application in XCode. On the main view there is a UIButton. Then I created a second view called View2.xib which has a UILabel that says "Second View". Very basic.
Now, all I want to do is display the second view when you click on the button. In the view controller class for the first view that contains the button I added.
#import View2ViewController.h
View2ViewController *View2;
I also added the property for this, etc. This class also has the IBAction for the button click event, which works just fine and executes when clicked. Now, in the .m file I obviously @synthesize View2; and begin to edit the button click method to display the view. Here is the code:
Code:
if(self.View2 == nil) {
View2ViewController *two = [[View2ViewController alloc] initWithNibName:@"View2" bundle:[NSBundle mainBundle]];
self.View2 = two;
[two release];
self.navigationController pushViewController:self.View2 animated:YES;
Everything complies, and runs. When I click on the button the application does NOT display the second view. Nothing crashes, but it doesn't display the view. What am I doing wrong? I have everything linked up in Interface Builder.

I figured this out. You have to remove the current view from the window and then add the new view via addSubView: after it is loaded from the nib file.

Similar Messages

  • Im trying to watch movies from my macbook pro to my new vizio, but when I connect the minidisplayport to HDMI cable to input 2, and switch the input from my remote to that input, nothing happens.  What am I doing wrong?

    I am trying to watch movies from my macbook pro (2010) on my new vizio tv.  I connected the minidisplayport to HDMI cable (bought from the apple store) and switched the input to the right input but nothing happens. What am I doing wrong?

    Hi T,
    Open Sys Prefs > Displays and check the settings there.

  • I am in Aperture photos-browser - view. Amtrying to find "sort"  by file name to elimanate duplcates.  Sort option does not appear. Not sure what I am doing wrong.

    I am in Aperture -photos - browser - view.  Am trying to find "Sort"  by filename to elimate duplicates. I cannot find "sort in Viewer and not sure what I am doing wrong.  Help

    This is what the top of the Viewer should look like:
    Here is the same view with the pulldown opened:
    What is it that you see? Include a screenshot.

  • When I turn on my iPad the grey 'brightness slider' is in the centre of the screen and I can't get rid of it. I've tried switching on / off 'auto-brightness' in 'settings' but it won't go away. What am I doing wrong? Any advice gratefully received.

    When I turn on my iPad the grey 'brightness slider' is in the centre of the screen and I can't get rid of it. I've tried switching on / off 'auto-brightness' in 'settings' but it won't go away. What am I doing wrong? Any advice gratefully received.

    That folder with the question mark icon means that the MacBook can't find the boot directory. That can either mean it can't find the hard drive or the Operating System data on the hard drive is somehow corrupted.
    Put your install DVD into the optical drive (CD/DVD drive) and reboot. As soon as you hear the boot chime, hold down the "c" key on your keyboard (or the Option key until the Install Disk shows up). That will force your MacBook to boot from the install DVD in the optical drive.
    When it does start up, you'll see a panel asking you to choose your language. Choose your language and press the Return key on your keyboard once. It will then present you with an Installation window. Completely ignore this window and click on Utilities in the top menu and scroll down to Disk Utility and click it. When it comes up is your Hard Drive in the list on the left?
    If it is then click on the Mac OS partition of your hard drive in the left hand list. Then select the First Aid Tab and run Repair Disk. The Repair Disk button won't be available until you've clicked on the Mac OS partition on your hard drive. If that repairs any problems run it again until the green OK appears and then run Repair Permissions.
    If your hard drive isn’t recognized in Disk Utility then your hard drive is probably dead.

  • I have set hyperlinks within my ibook author document, they work perfectly until i export and view on the ipad, when only one or none work, (hyperlinks to website not working at all) what am i doing wrong?

    I have set hyperlinks within my ibook author document, they work perfectly until i export and view on the ipad, when only one or none work, (hyperlinks to website not working at all) what am i doing wrong?

    An external hyperlink should handoff to Safari and leave iBooks.
    If that's not happening, perhaps there is something misconfigured on your iPad? Have you manually confirmed those links work in Safari on your iPad?

  • I have a MAC and when i look things up it keeps asking me to install latest adobe flash [layer. I complete installation but it still does not allow me to view. What am I doing wrong?

    I have a desktop computer- MAC. When I am looking for information or pulling up games for my grandkids,  it will say I need to download the latest version of dobe Flash Player to view. I have downloaded this numerous times yet it still does not allow me to view. What am I doing wrong?

    Could be the OS X version is too old for the later recommended Flash player version.
    So this is where knowing what your computer really is, and the exact OS X version running in it. There is a hardware limit to upgrading the OS X in a PowerPC Mac with a ceiling of OS X 10.5.8 at the latest. This also limits the upgrade to a later version Adobe Flash player.
    If the computer is not an older PPC-based Mac, and instead has an Intel core-duo or core2duo, an upgrade to OS X 10.6.8 is possible through purchase of the retail Snow Leopard 10.6 DVD and after installation, run Software Update to get the 10.6.8 Combo update v1.1 for Snow Leopard. This will not work on a PowerPC based Mac.
    Should the computer be able to run a later OS X, a newer Player could be installed.
    If the ceiling as suggested above be the case, and the workaround possible.
    The question posed by Klaus is a minimal request for basic info.
    Good luck
    edited

  • Having a hard time binding my viewmodel class to my view, what am I doing wrong?

    I've got a ViewModel class named SpecMapViewModel. I've got it referenced in the Window tag of a window, like this:
    xmlns:vm="clr-namespace:SpecMapException.ViewModels"
    Next I have it in the Window.Resources section like this:
    <vm:SpecMapViewModel x:Key="SpecMapVM" />
    And lastly I've trying to bind it to a ComboBox, like this:
    <ComboBox x:Name="cmbSources"
    DisplayMemberPath="CdValue"
    MinWidth="100"
    ItemsSource="{Binding ObsSpecimenSources}"
    SelectedValue="{Binding CdValue}"
    SelectedValuePath="CdValue" />
    I've both put a DataContext attribute in the ComboBox's tag, and I've also tried assigning the DataContext in the Window_Loaded event. Neither has worked.
    So what am I doing wrong?
    Rod

    Hi Doctor-Who,
    Based on your code snippet, I could not find some issue, I suggest that you could check the DataContext was assigned in a right way. Then I have made a code sample, I assigned the DataContext to window, and the same as your ComboBox. You could refer to it,
    and find some different with your code. I hope it would be helpful to solve you question.
    <StackPanel>
    <ComboBox DisplayMemberPath="CdValue"
    MinWidth="100"
    ItemsSource="{Binding ObsSpecimenSources}"
    SelectedValue="{Binding CdValue}"
    SelectedValuePath="CdValue"></ComboBox>
    </StackPanel>
    SpecMapViewModel.cs
    class SpecMapViewModel : INotifyPropertyChanged
    private ObservableCollection<SpecMap> _ObsSpecimenSources;
    public ObservableCollection<SpecMap> ObsSpecimenSources
    get { return _ObsSpecimenSources; }
    set
    if(value != null)
    _ObsSpecimenSources = value;
    OnPropertyChanged("ObsSpecimenSources");
    public SpecMapViewModel()
    ObsSpecimenSources = new ObservableCollection<SpecMap>();
    ObsSpecimenSources.Add(new SpecMap {CdValue="abc" });
    ObsSpecimenSources.Add(new SpecMap { CdValue = "def" });
    public event PropertyChangedEventHandler PropertyChanged;
    private void OnPropertyChanged(string PropertyName)
    PropertyChangedEventHandler handler = PropertyChanged;
    if(handler != null)
    handler(this,new PropertyChangedEventArgs(PropertyName));
    private void Window_Loaded(object sender, RoutedEventArgs e)
    SpecMapViewModel viewmodel = new SpecMapViewModel();
    this.DataContext = viewmodel;
    Best Regards,
    Xavier Eoro
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Having switched from iPhoto to ICloud Photo I find that their are many, many double and triple photos. Just added a small folder of photoes and all are showing in photos as doubles. What am I doing wrong?

    Having switched from iPhoto to ICloud Photo I find that their are many, many double and triple photos. Just added a small folder of photoes and all are showing in photos as doubles. What am I doing wrong?

    Martin,
    I am not sure, however you may want to post in the Photos forum, please click Photos for Mac to get there.

  • I have downloaded Adobe Content Viewer to my iPad. When I try to sign in with my Adobe ID, I keep getting Authentication Failed. What am I doing wrong?

    I have downloaded and istalled Adobe Content Viewer to my iPad. When I try to sign in with my Adobe ID, I keep getting Authentication Failure, what am I doing wrong?

    Thanks for the quick reply.
    Do you have any examples of system extensions or accessibility features that might be the culprit?  I have actually never heard of those terms before.

  • Created project in imovie. Trying to move to iDVD to burn. the project in imovies is great. When I view the project in iDVD the audio is messed up. What am I doing wrong?

    I created project in imovie 10. When I send it to idvd to burn copy the audio is not in right places. Some muted audio is not muted and other audio clips are with wrong video clips. I don't know what I am doing wrong. Help.

    I'm not sure what you mean by iMovie 10 (there is no such version). However, if you mean iMovie '09 (version 8) or iMovie '11 (version 9) there is a fix I can suggest.
    If you have used slow motion or fast motion in your video, you MUST use only the presets on the speed slider, which are: 12.5%, 25%, 50%, 100%, 200%, 400% and 800%.
    If you have used custom settings by manually entering speed percentages (different to the presets), you will almost certainly experience audio glitches in the exported movie. These glitches are not evident in preview (before sharing) but appear only in the exported movie (as you have experienced).
    The fix is to re-visit your project and adjust all speed changes to the preferred preset percentage. This can be a pain, as you may have to re-sync video and audio - but it is the only fix (unless you want to go through a very convoluted process). After adjusting the speeds to the presets, you will of course have to re-export the project.
    Note that the glitch is well known in iMovie '09, but may have been fixed in iMovie '11. Which version are you using?
    John

  • HT4108 I hooked up my iPad retina to my tv with an apple hdmi connection  then switched to that source and nothing happened. What am I doing wrong?

    I would love to see my photos from my iPad on my Samsung tv.  Purchased necessary connectors from from apple store (hdmi ect) set the proper source on tv -- nothing. What am I doing wrong?

    Hello Jogindra,
    Welcome to the Apple Support Communities. If you are having issues with AirPlay, here is an article on troubleshooting the issue. It goes into not seeing the icon and performance issues.
    Troubleshooting AirPlay and AirPlay Mirroring
    http://support.apple.com/kb/TS4215
    Regards,
    -Norm G.

  • Home sharing is on, but library does not show up under sharing. Turned off then on again and home sharing shows up and the disappears when I click done. What am I doing wrong???

    Home sharing can't connect on my computer. It will recognize a library on one computer but not another. Tried turning it off and then on and got nothing. Tried switching to a different apple I'd and got nothing. I have the latest version of I tunes. What am I missing? What am I doing wrong? Can anyone help?

    Are you connected to the same SSID network?
    to make things a little more easy, i'd perfer to have all my itunes on a network drive for all pc's connected to one itunes and scratch the home sharing itunes to view under another itunes.
    Only problem im having is that wrong pictures are showing up for movie/tv show connecting to different computers conecting to one itunes library.
    Home Sharing on iPods show wrong pics

  • I have set up a second iTunes user account on my PC, but when I create the new iTunes account it copies the music, videos etc from the original account and they seem to be linked.  What am I doing wrong?

    I have set up a second iTunes user account on my PC, but when I create the new iTunes account it copies the music, videos etc from the original account and they seem to be linked, so that when I delete a song from one library it deletes from the other one. 
    On the online tutorials I've seen it shows that when you create a new iTunes library it should open as a blank account, but that isn't happening.
    What am I doing wrong?

    If you  have iTunes 11 turn on the Sidebar. Go to iTunes>View and click on Show Sidebar. You can also do a Crtl+S to show the sidebar. The sidebar is where Devices appears. and Control+B to show the Menu bar
    If necessary:
    iOS: Device not recognized in iTunes for Windows
    or
    iOS: Device not recognized in iTunes for Mac OS X

  • After attempting to process my movie, I get the following message. "The project could not be prepared for publishing because an error occurred. (OpWrErr: file already open with with write permission). Any ideas what I'm doing wrong?

    After attempting to process my movie, I get the following message. "The project could not be prepared for publishing because an error occurred. (OpWrErr: file already open with with write permission). Any ideas what I'm doing wrong?

    Hi
    Error -49 opWrErr  File already open with write permission
    Trash the preference files while application is NOT Running.
    from Karsten Schlüter
    Some users notice on exporting larger projects from within iMovie that this operation is aborted with an 'error -49'
    This issue occours only on MacOs machines using 10.7x
    try switching-off the Local Mobile Backup
    in Terminal copy/paste
    sudo tmutil disablelocal
    Re-launch Mac
    Yours Bengt W

  • HT1343 On my 4 1/2 year old Macbook I could select multiple files  by highlighting a file and then moving cursor over a file lower in the list, and pressing shift-control-click. I can't do that in now with Mac Pro.  What am I doing wrong?

    ghlighting a file and then moving cursor over a file lower in the list, and pressing shift-control-click. I can't do that in now with Mac Pro.  What am I doing wrong?

    Holding down the control key will invoke "right-click."
    Depending on the View, holding down Shift will with either toggle the selection (Icon View), or it will make a continuous selection from the previous selection (List View or Column View).
    The only way to make a continuous selection in Icon View is to drag out a selection marquee around or through the icons.
    I can't remember the behavior of previous OS's.

Maybe you are looking for

  • Viewing pdfs with Quick Look is too small in Lion?

    I tried to search for this everywhere and I didn't see much input. I'm a grad student in the biomedical sciences. I need to keep a large library of pdfs for my work and one of the best things about switching to a mac was being able to use quick look

  • Cannot invoke servlet from JSP

    I am trying to invoke a servlet from my JSP file. At present I am getting the error: 500 Internal Server Error java.lang.IllegalArgumentException: Resource /servlet/CreateSPSS not found      at com.evermind[Oracle Application Server Containers for J2

  • Disable second monitor at host at login.

    As an IT guy using Central, I have several clients that I have given access to their computers.  Multiple of thest clients have requested that the second monitor on the host computer be disabled when logging in.  They would like to replicate how RDP

  • Installing Solaris 10 x86??.

    Hi Folks, I am new to Solaris and have been trying to install a copy of Sol 10 x86 to VMware workstation 5.5. When I start the VM it boots the solaris dvd fine and then the following happens.... Loading Stage 2....... (The screen hangs at this for ab

  • I have lost my CD. What must I

    Where can i download drivers for Creative Rhombo 256mb please help me