IPhone Programming: Using a Button to change views in iOS4

Hey guys,
I've been working with the iOS3 version until the other day when I began recreating my project and updating it for iOS4.
I'm using a tab bar with 4 icons, the first tab being a "Home" screen.
On the home screen I have 4 buttons that trigger another xib to be added via the addSubview method. See code below. (if a screen shot is more helpful please let me know I'll upload one)
HomeViewController.m:
#import "HomeViewController.h"
#import "EventsViewController.h"
@implementation HomeViewController
EventsViewController *eventsViewController;
- (IBAction) eventsClicked:(id)sender
eventsViewController = [[EventsViewController alloc]
initWithNibName:@"EventsViewController"
bundle:nil];
[self.view addSubview:eventsViewController.view];
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
- (void)dealloc {
[super dealloc];
@end
EventsViewController.m
#import "EventsViewController.h"
@implementation EventsViewController
@synthesize events;
- (void)viewDidLoad
// Just an example URL for display purposes
NSString *urlAddress = @"http://www.google.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[events loadRequest:requestObj];
[super viewDidLoad];
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
- (void)dealloc {
[super dealloc];
@end
For some reason the program builds/compiles and runs fine EXCEPT when one of the 4 buttons are hit on the home screen that trigger another xib to load.
So my question is how do you properly load another xib when a button is clicked.
Any thoughts/comments/suggestions are greatly appreciated.
Thanks,
Justin

Sorry, misread your post...
Message was edited by: xnav

Similar Messages

  • Using a button to change a vstack view

    I have a vStack containing several Hboxes with id's that are
    called from xml lists which are called in an a dataprovider of a
    PopUpMenuButton, and all works fine.
    However the Interface requires a button that when clicked
    goes to the first Hbox id called "default". The button has to be
    place in one of the Hboxes in the vStack.
    How can I do this please?

    Hi,
    Thanks for the quick reply, that worked perfectly.
    Thanks again

  • Execute program using a button on Selection screen

    Hi Experts,
    I had placed a push button on my selection screen and now i want this button to carry all the behaviour of the std F8 function in terms of validations and execution.
    How can i do this?
    Thanks
    Dany

    Adding to the good answer provided above, you need to put your validation logic in the event At USER-COMMAND. There is where you will process the command (function key) raised by clicking on the toolbar. (assuming you did the step described by Reddy).
    Leonardo De Araujo

  • Focus stays when change view

    Hello,
    I have a viewstack with 2 views.
    In view 1 is a textinput.
    In view 2 is an image.
    when i startup my application, view 1 is shown.
    I type an a in the textinput.
    Now i press a button and it goes to view 2.
    I type bcd.
    I close this view to return to view 1, and what i see is in my textinput shows bcd as value.
    I tried to kill the focus when i press the button to change view but it doesn't work.
    Please some help.
    Code i tried:
    this.stage.focus=null;
    Application.application.focusManager.deactivate();
    this.focusmanager=null;
    this.focusEnabled=false;
    this.focusManager.deactivate();

    The button is in a menubar.
    Is there a general place and/or function so i can see wich item in my project received focus?
    Should i do something like creating an eventlistener on the stage that calls a function on each enterframe so i can trace focus?
    I did solve my problem by setting: myMenuBar.focusenabled=true;
    and when i click on the menu i put focus on the menubar by setting; stage.focus=myMenuBar;
    I wonder if this is the best solution, cause when you are inside the second view and you use for example the S for a stroke function inside the second view, but you also created a menu shortcut with the S that saves your project.
    This way the S will save the project because the menubar has focus..
    Or would this be the only solution and youll have to be sure not to use the same key for different functionality?

  • TS3899 Cannot send mail from IPHONE 4S using AOL..tried every setting and resetting...ATT did a Network reset last week

    I cannot send email from my Iphone 4s using AOL
    I have changed and reset and deleted the account and no matter what
    I do I cannot send an email...There are two accounts setup on AOL and it is only
    one that cannot be sent and it is my husbands email.  MIne works fine.   On his IPHONE
    both emails work fine and settings are the same
    Last week ATT did a system reset on my phone and I do not know if this
    has anything to do with it but no matter what I do I cannot fix it
    I can send from GMail but not AOL
    Thank you

    I cannot send email from my Iphone 4s using AOL
    I have changed and reset and deleted the account and no matter what
    I do I cannot send an email...There are two accounts setup on AOL and it is only
    one that cannot be sent and it is my husbands email.  MIne works fine.   On his IPHONE
    both emails work fine and settings are the same
    Last week ATT did a system reset on my phone and I do not know if this
    has anything to do with it but no matter what I do I cannot fix it
    I can send from GMail but not AOL
    Thank you

  • How to make Visible and Invisible using a Button?

    hi!... I've a Text3D using Oriented3D object and I would like to know how to make it visible and invisible by clicking a button.
    I know there is a function, setVisible() in RenderingAttributes, which can be set by the object's Appearance.
    Since I want to use a button to change the object's appearance, I need to change it in the button's actionPerformed function, but it has thrown an exception:
    "Shape3D: no capability to set appearance".
    I'd tried using those setCapability flags... but still nothing...
    Could someone help me please?...
    Thanks

    When you create Shape3D, setAppearance to it and
    setCapability(ALLOW_APPEARANCE_READ).
    For the Appearance, you should setCapability(
    ALLOW_RENDERING_ATTRIBUTES_READ).
    For the RenderingAttributes, you should setCapability(
    ALLOW_VISIBLE_WRITE).
    So in the button event handler,
    shape.getAppearance().getRenderingAttributes().setVisible(true/false).
    Now you can control the visiblity of Text3D

  • My iphone 5 will not let me control my volume at all. it is turned all the way up.  i try to use the buttons on the side of the phone and they dont work and when im on a call i cant change the volume.

    Im having trouble with my iphone 5.  For about 6 months now i cannot change my volume while on the phone or using the buttons on the side to turn the volume down. I took it to the sprint store so they could fix it and they said they have never had this problem before.  Ive owned every iphone from the very beginning and never had this problem before. please help.

    Have you tried going to Settings> then tapping on Sounds. and making sure that change with buttons is turned on?

  • I brought iphone 5 in US. But i had gone back to Vietnam. I want to replace the sleep wake button. My iphone 5 serial number i entered is eligible for "iphone 5 sleep/wake button replacement program. Expired day of program??? Can isend my iphone to US?

    And if i want to change iphone 5s, requirements?? Thanks!

    Hi tamseny,
    It appears that you may have a hardware issue with the sleep/wake button on your iPhone 5. Please go to the following web page
    iPhone 5 Sleep/Wake Button Replacement Program - Apple Support
    https://ssl.apple.com/support/iphone5-sleepwakebutton/
    and enter in your serial number to see if you qualify for the replacement program. Thanks for using the Apple Support Communities!
    Cheers,
    Bradenh

  • How do you program the voicemail button on an iPhone 4s?

    I've seen lots of solutions using *5005*86 or whatever but this doesnt work for me. I have a UK registered phone provided but by my employer and uses Vodafone for voice and BTmobile for data. Is it this set up that is preventing me from programming the voicemail button?

    Voicemail is a carrier feature, not a phone feature, so your first step is to call Vodafone. Here's Apple's support steps:
    http://www.apple.com/support/iphone/assistant/voicemail/

  • HT5361 When inserting pictures in a new mail message using the " photo browser" button I can view and select photos but the " choose "  button is gone. What have I done wrong?

    When inserting pictures in a new mail message using the " photo browser" button I can view and select photos but the " choose "  button is gone. What have I done wrong?

    Hi Liz,
    Sorry to hear you are having a similar problem.  Last night I went to the tool bar at the top of iphoto, clicked on "File",  then clicked "Browse Backups" in the drop down menu.    I have an external hard drive that is set up to Time Machine.   The Browse Backups  opened the iphoto pages in the Time Machine.  I selected a date one day ahead of the day I performed the now infamous update, and it showed my iphoto library as it had existed that day.   I then clicked  "Restore Library" at the bottom right corner of the Time Machine screen.   Roughly 2 hours later my iphoto was back to normal.   When I opened iphoto there was a message saying I need to upgrade my program to be compatible with the new version of iphoto(version 9.2.1).  I clicked "Upgrade" and within seconds it had done whatever upgrading it needed to do. 
    The only glitch in the restoration was that it restored the library as it appeared last week, so I no longer had photos I had imported this past weekend.   I simply went back to the Browse Backups in the drop down menu,  when Time Machine opened I selected the page showing my pictures from this weekend and again said to Restore Library.   Roughly 45 minutes later the library was restored including the most recent photos.  
    I am now a happy camper. 
    I don't know if any of this will be of help to you because your email says you are having trouble with photos imported after the upgrade was performed.   Have you had any pop up notices when you first open iphoto,  that tell you you need an upgrade to be compatible with the new iphoto?     If so have you clicked "upgrade"? 
    Good luck Liz,  if you have Time Machine running as a back up to your library, maybe you wil be able to get help there, by following my instructions above.   Otherwise,   good luck with your investigations.   I'd be interested in hearing how you make out.
    Karen

  • Replacement Program For Faulty iPhone 5 Sleep/Wake Buttons

    My iPhone 5 apply to Replacement Program For Faulty iPhone 5 Sleep/Wake Buttons, but I'm in Argentina. How can I participate if my country doesn't appear in the list of participating providers to fix the problem?
    Argentina will be added to the program?
    I can't travel to US... Help please!

    Hey there kevinfur91!
    I have a link for you that should be able to help you find the best support option in your area for this issue. This link is for the generic page regarding this issue, but you will want to use the drop down menu on the left hand side of the page to choose “Latin America” and see the support options that are most relevant to your area:
    iPhone 5 Sleep/Wake Button Replacement Program - Apple Support
    https://ssl.apple.com/support/iphone5-sleepwakebutton/
    This page will also require that you enter your iPhone’s serial number in order to see your support options. If you need help finding your serial number, please refer to the following article for assistance:
    iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number
    http://support.apple.com/kb/HT4061
    Thanks for being a part of the Apple Support Communities!
    Regards,
    Braden

  • When i open my Canon RAW-files with preview or transfer them to another program using preview they change to color despite the fact that they where all shot in B/W... How to change this?

    When i open my Canon RAW-files with preview or transfer them to another program using preview they change to color despite the fact that they where all shot in B/W... How to change this?

    I shoot only RAW - no JPEG-files except those visualizing the files on my memorycard or computer. I think i have to refine my question;
    1. I know there is possible to make B/W HDR-images.
    2. I know the best HDR images are based on RAW-files.
    3. When i transfer the images in question to a HDR software they change, so when i view them in the software (either Preview or the HDR software) they are suddenly viewed (and processed) in color.
    4. This never happend on my PC so i know it has to do  with either Finder or Preview.
    5. Do i have to make all my B/W HDR-images on the PC or is it a way for me to change how Finder/Preview show/alter my images?

  • I have bought an used Iphone 5. I dont have the password for the existing login id of the old owner. How do i use the phone and change the log in id?

    I have bought an used Iphone 5. I dont have the password for the existing login id of the old owner. How do i use the phone and change the log in id?

    Unfortunatly the only way that you can get it off is to get the old user to input the password.  You may need to contact that old user and see if he can put the old password in.  hope this helps.

  • Hello, i have updated my iphone 5 black 16 gb to ios 7 ios 7.0.2 (11a501) and my battery has become worse it gives 9 hours of usage with out doing anything, i have done everything i tried, not using my iphone as well but still no change at all!

    hello, i have updated my iphone 5 black 16 gb to ios 7.0.2 (11a501) and my battery life of my iphone has become worse it gives 9 hours of usage with out doing anything, i have done everything every tip that is available online i had 3gs and 4s so i know how to save battry life,i even tried  not using my iphone as well but still no change at all!. i have upadted to ios 7.0.3 then downgraded it , i thought battery may be an issue ,so i put  brand new battery still no change , so what should i do ? , update to the latest version which is ios 7.0.4 or wait for the ios 7.1 , i was using iphone 4s running on ios 6.1 it gave me 3 days of battery timing , iphone 5 seemed to be very bad for me ,help ! ?
    its facory unlocked btw

    Try to do a reset, if it doesn't work try remove recently added apps this may solve your problem ( like google app because it has happened with me)
    Take a look at apps using your location service in privacy, it can cause battery draining.

  • Purchased ipad already got apple id through itunes and iphone but it is not an email address ipad setup process will not allow me to use current id or change id to primary email address - do i have to have different id for ipad

    Purchased an ipad but already got apple id through itunes and iphone but is not an email address, ipad setup process will not allow me to use current id or change id to primary email address - do I have to have different id for ipad

    It does have to be a verifiable email address though, you can change it here:
    Apple ID support
    http://www.apple.com/support/appleid/

Maybe you are looking for

  • Hd died.. need to reinstall Tiger on external

    i need to install Tiger on my Maxtor (firewire) external hard drive. obviously i can't 'archive and install' because i didnt have Tiger on my external drive to begin with. however, will i lose all the files on my external when i select the "install T

  • What is wrong????  I cannot get Itunes to open on my windows 7 laptop!!

    What is wrong with my Itunes????  I have been trying to open my Itunes on my windows 7 laptop and it won"t!!  I have tried reinstalling...to no avail.  I hope someone can help a rather computer-challenged old person!!

  • Basic Encryption Question

    Hello all, I am trying to do a basic string encryption and decription but am getting an exception. java.security.NoSuchAlgorithmException: Algorithm DES not available Here is a code that I found online and I am trying to run it as an example. I am us

  • Itunes producer error

    Hi friends, I am again here with a problem: in this period everything is going wrong! I have 8 titles already present in the ibook store: definitely I have repeated this operation several times, but for the first time it does not work, apparently wit

  • Finding "Zero Sales Products"

    Hi All I am New To Oracle And Need Some Help In Writing A Query In SQL. I Have The Below Tables SQL> desc sales_invoice; Name Null? Type INVOICE_NO NUMBER(3) INVOICE_DATE DATE PRODUCT_CODE VARCHAR2(2) QUANTITY NUMBER(6,3) RATE NUMBER(6,2) VALUE NUMBE