IPhone SDK - Multiple buttons calling the same IBAction

Hi,
Can I call the same action with multiple buttons? I´ve just connected
the action to the buttons in interface builder, but in the header file
I can´t use - (IBAction)setOperator: (id)sender; as the parameter to the function, it always crash due to uncaught exception. If I use - (IBAction)setOperator; it
works, but i can´t differentiate wich button was pressed.
I don´t know if i can set the (id)sender parameter in the interface
builder. Can anyone help me?
Thanks,
Pitteri

.h file:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface CalculatorView : UIView {
IBOutlet UITextField *txtResult;
IBOutlet UIButton *btnMult;
IBOutlet UIButton *btnDiv;
@property (nonatomic, retain) UITextField *txtResult;
@property (nonatomic, retain) UIButton *btnMult;
@property (nonatomic, retain) UIButton *btnDiv;
- (IBAction)setOperator:(id)sender;
@end
.m file:
#import "CalculatorView.h"
@implementation CalculatorView
@synthesize btnDiv, btnMult, txtResult;
- (IBAction)setOperator:(id)sender{
//if btnMult pressed
//bla bla bla
//if btnDiv pressed
//bla bla bla
that´s my code. Hope u can help.
thanks
@end

Similar Messages

  • Multiple threads calling the same stored proc with different parameters

    Hi,
    I have a stored procedure which will be called by 8 threads. Every time it takes in a different parameter.
    Actual execution time for this proc (irrespective of the parameter) is around 2 seconds. But when I call the 8 threads, I see that the total time taken (END TO END) is around 16 seconds. Threads do acquire a read lock right? Is there a way i can get over this issue?
    Please let me know.

    Sybase IQ is the database. I am using a thread pool. The time taken to execute this procedure without threads is about 2 seconds. It takes 16 seconds when I start using threads.
    I do something like this :
    ///////////////////////// databaseThreadPool.java
    * example of a fixed-size thread pool using the
    * executors introduced in Java 5
    import java.util.concurrent.ExecutorService;
    import java.util.concurrent.Executors;
    public class databaseThreadPool
    public static void main(String[] args)
    * create a thread pool with four threads
    ExecutorService execSvc = Executors.newFixedThreadPool( 8);
    * place six tasks in the work queue for the thread pool
    for( int i = 0; i < 6; i++ )
    execSvc.execute( new CountDown() );
         long a =System.currentTimeMillis();
    execSvc.execute( new databaseThread("00055","YTD","GROSS") );
    execSvc.execute( new databaseThread("00055","YTD","NET") );
    execSvc.execute( new databaseThread("00055","YTM","GROSS") );
    execSvc.execute( new databaseThread("00055","YTM","NET") );
    execSvc.execute( new databaseThread("00055","LY","GROSS") );
    execSvc.execute( new databaseThread("00055","LY","NET") );
    execSvc.execute( new databaseThread("00055","LLY","GROSS") );
    execSvc.execute( new databaseThread("00055","LLY","NET") );
         long b =System.currentTimeMillis();
         try{
         while(databaseThread.done!=8)
              Thread.sleep(1000);
         catch(Exception ex){}
    execSvc.shutdown();
    System.out.println("END TO END TIME TAKEN : "+(b-a));
    /////////////////////////////////////////////////////////// databaseThread.java
    import java.io.PrintWriter;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.Statement;
    import java.io.PrintWriter;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.io.IOException;
    public class databaseThread implements Runnable
    protected int count = 8;
    * the following counter is incremented once
    * each time the class is instantiated, giving each
    * instance a unique number, which is printed in run()
    private static int taskCount = 0;
    private final int id = taskCount++;
    private String gpNum;
    private String time;
    private String domain;
    public static int i=0;
    public static int done=0;
    PrintWriter out = null;
    Connection connection = null;
    Statement statement;
    ResultSet rs;
    ResultSetMetaData rsmd;
         CallableStatement cStmt = null;
    public databaseThread(String gpNum, String time, String domain) {
    this.gpNum=gpNum;
    this.time=time;
    this.domain=domain;
    * print the id and the iteration count to the console, then
    * yield to another thread.
    public void run()
         try
         Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
         connection = DriverManager.getConnection("jdbc:sybase:Tds:XXXXXXXXXXX:XXXXXXX", "cp_dbo","cp_dbo");
         statement = connection.createStatement();
              cStmt=connection.prepareCall("{call XXXXXX ?,?,?)}");
              cStmt.setString(1,gpNum);
              cStmt.setString(2, time);
              cStmt.setString(3,domain);
              long a =System.currentTimeMillis();
              rs=cStmt.executeQuery();
              long b=System.currentTimeMillis();
              System.out.println(id+" Time taken by to execute Query : "+(b-a));
         //rsmd=rs.getMetaData();
              while(rs.next())
              Thread.yield();
         catch (ClassNotFoundException e) {
              System.out.println("Driver Error" );
              e.printStackTrace();
              } catch (SQLException e) {
              System.out.println("SQLException: " + e.getMessage());
    }

  • Multiple submit button on the same form

    Hi,
    I have created a PL/SQL procedure which generates a HTML form using htp and below is part of the code.
    Create or Replace PROCEDURE OBM_PROCEDURE
    htp.formOpen(OWA_UTIL.GET_OWA_SERVICE_PATH || 'insert_obm');
    htp.formSubmit(cvalue=> 'Insert');
    This creates the form and clicking Insert button calls the other procedure (insert_obm).. works fine.
    I could create other buttons like "Query" "Update" "Delete" on the same form using following.
    htp.print ('<INPUT TYPE=submit VALUE="Query"> ');
    But all the buttons call the same form (insert_obm) since they are in the same form. How do I make the buttons call different procedure?
    Thanks,
    Jee

    Hi,
    The best way to do is call a single procedure as you are doing on form submit and check which form submit was clicked ,say based on the submit value and then do the processing accordingly i.e whether it is INSERT or DELETE.
    Hope this helps,
    Thanks,
    Anu

  • TS3367 I have two IPhones and one IPad all with the same Apple ID. I can call facetime between the two IPhones, but I cannot call the IPAD from either of the IPhones and when I call my IPhone from the IPad it rings my wife's IPhone after briefly calling m

    I have two IPhones and one IPad all with the same Apple ID. I can call facetime between the two IPhones, but I cannot call the IPAD from either of the IPhones and when I call my IPhone from the IPad it rings my wife's IPhone after briefly calling mine.

    Each device needs a separate address. Use an email address (gmail.com) on the iPad.
    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    For non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
     Cheers, Tom

  • If i have multiple iPhones and Mac Mini sharing the same Apple ID, can I use Facetime between the devices?

    if i have multiple iPhones and Mac Mini sharing the same Apple ID, can I use Facetime between the devices?

    Yes, but if you want these devices to have complete capability of calling each other they each must have their own separate, individual e mail address.  If they don't have individual e mail addresses, the i phones will be able to call each other because you'll be using their  individual phone numbers -- the Mac mini will be able to call the i phones, but, the iphones will not be able to call the Mac mini.  This is because the iphones will be using the mini's e- mail address to make the call, and if they have the same e mail address, they will think they are calling themselves, so the call will not connect.
    So, the way I see it is,  if you keep all of the email addresses the same, the only thing you'll loose is the ability of the iphones to call the mini.
    EDIT:  Thinking about it, my first sentence needs to be modified.  Your iphones can share an email address but it must be different from the Mac mini address.
    This isn't rocket science, but it can make your head spin. LOL

  • Call and Execute Multiple Windows of the same VI

    Hi,
    I would like to call and execute multiple windows of the same VI.
    Please take a look for my attached vi, and start from the 2x2.vi, i think you have to re-enter the file path to run (sorry for inconvenience).
    If I click the start button in different sub panels, the sub vi(Temperature Analysis.vi..& etc) should be called out in multiple windows, hold it, and run simultaneously.
    But now the problem is, the sub vi is called out 1 by 1 until it is finished prior the second sub vi is called.
    May I know how to solve that?
    Thanks.
    Attachments:
    My VI.zip ‏173 KB

    Hello TanTan
    1. Open the PopUpmain.vi and select the path of PopUp.vi
    2. Enter the number of popups and run the VI.
    Hope this attached VI will work as per your expection. Please select the less number of instances 
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet
    Attachments:
    PopUpMain.vi ‏12 KB
    PopUp.vi ‏8 KB

  • HT4847 Can I have multiple users's family devices backed up to the cloud e.g. 2 iPhones and 2 iPads under the same iTunes account

    Just got a second iPad for the home.
    Can I have multiple users's family devices backed up to the cloud e.g. 2 iPhones and 2 iPads under the same iTunes account?

    Yes, but it's not usually recommended to share an iCloud account within a family.  If you do, any data you sync with iCloud will be merged and you, for example, will end up with each other's contacts and calendars on your devices.  Also, any action taken on one device (such as adding or deleting a contact) will be replicated on the other devices.  You will also all be sharing the same 5GB of free storage for all your data and device backups.
    Normally it's best to use separate iCloud accounts for each person's devices.  This will keep your data separated, and allow each person to have their own free 5GB of storage.  You can continue to share the same iTunes ID within the family; the ID you use for iCloud does not need to be the same as the one your use for iTunes purchasing.  (Each person should also use a separate ID on their devices for iMessage and FaceTime to avoid getting each other's text messages and FaceTime calls.)

  • My iphone 4 locked up for several hours. i then tried to reset by holding down the home button and power button at the same time for 10 seconds and then the home button for 10 seconds. it is now completely black. what do i do? couldnt restore it in iTunes

    My iphone 4 locked up for several hours. i then tried to reset by holding down the home button and power button at the same time for 10 seconds and then the home button for 10 seconds. it is now completely black. what do i do? couldnt restore it in iTunes. Has anyone had this problem? Help!

    Same thing happened to me today. I wasn't even using the phone for the past 6 hours and suddenly I can't connect to the internet, none of my internet apps would work - nothing. I tried to call AT&T from the iphone and it locked up - couldn't turn it off, change to the home screen - nada - brick.
    Did the Home/Power button thing and that worked but this I've only had this phone for about 4 weeks and it's locked up more times than my 3GS did the whole two years I had it! Ridiculous

  • Multiple toggle buttons to the same destination causes conflicts

    I'm trying to set up multiple toggle buttons so that a user can click on a button at any time and set the state of the dashboard. Each toggle button has a unique value (and each one has the same static value for both on and off) and I've mapped all the toggle buttons to the same destination cell. But they all seem to be competing to set the desination to their preferred value even when they're not being clicked on and, as a result, the dashboard keeps changing state in unexpected ways. Is there a fix for this?

    When you have multiple components trying to insert to the same destination cell, the front-most object wins at load time. So, if tb1, tb2, tb3 (tb3 being the front-most object) are all set to respectively insert values 1, 2, 3 to the same cell, the cell will have value 3 initially.
    Now there is an issue when objects in different groups try to insert to the same cell. The release note for FP3 implies that this problem is resolved, but I think it is not fixed completely...

  • I-phone shuts off, I have to hold the home and power button at the same time to get the icon to show up.  Then have to hold the home button.  I'm restoring my phone multiple times a day just to get it to work. help!

    i-phone shuts off, I have to hold the home and power button at the same time to get the icon to show up.  Then have to hold the home button.  I'm restoring my phone multiple times a day just to get it to work. help!

    Are you restoring as new?

  • HT1430 my iphone 4 stopped working suddenly....i held the on button and the home button at the same time and it cam on...is this a fault as i cant have my phone switching off randomly?

    my iphone 4 stopped working suddenly....it wouldnt charge or anything...i was told to push the on button and the home button at the same time and it came back on.
    is this a fault with the iphone????
    i cant have my phone switching off randomly...any help please...thankyou.

    sometimes it happens, a hard reset will sometimes solve the issue.
    If the issue starts happening more often, I would consider restoring the device to factory settings to install clean software. If the issue still persists after that, the device might need a hardware repair.
    More info on backing up and restoring the software: http://support.apple.com/kb/HT4137
    Good luck
    Stijn

  • 1.call information such as call waiting,call forwarding, call holding is not working when caller the call me or im wait for my call i cant see any title by iphon , and also holding is the same.2. there is not any option for call baring.

    Hi. please solve my problem.
    .call information such as call waiting,call forwarding, call holding is not working when caller the call me or im wait for my call i cant see any title by iphon , and also holding is the same.2. there is not any option for call baring.3.playback music is not hearing by second partner during the call.4.i cant select ringing ton from saving tons.
    thank you in advance.

    Hi Ersin,
    Exception 1 would seem to be FORMATTING_ERROR, which suggests something in the design of the Smartform.  However, that doesn't fit with the form being generated from a report, but only erroring when called from a function module.  I can think of no reason why the different calling method would be a factor.
    When FORMATTING_ERROR is raise it should also set a message ID and number, are you able to determine what they are?
    Regards,
    Nick

  • Help Calling the same vi after one button dialog

    hi need help aftr the the one dialog appears how to call the same vi again need help
    Message Edited by jeyanthi on 05-22-2008 10:13 PM
    Attachments:
    StationNumberEWS.vi ‏43 KB

    Why did you start a new thread? continue here
    Message Edited by MikeS81 on 05-23-2008 09:15 AM

  • How to display multiple reports at the same time

    Hi,
    I'm trying to display multiple reports at the same time, each one in separates tabs or windows using Forms 11g 11.1.1.6
    I have a button which has a call to a procedure which makes use of rp2rro library to show the specific reports, for example:
    call_report('report1');
    call_report('report2');
    call_report('report3');
    call_report('report4');
    The main problem is that, just the last report is been displayed.
    Is there some way to display report1, report2 etc in separate tabs or windows ??
    Regards
    Carlos

    You shouldn't have a problem calling different reports at once. As long as you're using Forms 11g they show up in different windows.
    The question is how you are calling the report.
    Here is how I manipulate it.
    After I pass parameters with the ADD_PARAMETER built-in I set some key values (destype, desformat, desname) with the RP2RRO's procedures.
    Finally calling RP2RRO.RP2RRO_RUN_PRODUCT and then WEB.SHOW_DOCUMENT passing the correct procedure parameters the report comes up in a window. If you repeat the above changing the appropriate variables (the report_name in the RP2RRO_RUN_PRODUCT and so on) you can get multiple reports in different windows.

  • Multiple accounts on the same resource

    Experts,
    I am trying to create multiple accounts for the same IDM user.
    I have written a workflow which calls the subprocess to create multiple accounts. In the orignal workflow I pass the IDM accountId and the target system accountid in the Iterate loop.
    In the subprocess i am checking out the user view then appending the resource specific parameters (mentioned below) and then checking in the view.
    <Activity id='1' name='Add resource to user object'>
    <Variable name='userObject'/>
    <Action id='1' name='CheckOut User View' application='com.waveset.session.WorkflowServices'>
    <Argument name='op' value='checkoutView'/>
    <Argument name='type' value='User'/>
    <Argument name='id'>
    <ref>userId</ref>
    </Argument>
    <Argument name='TargetResources' value='EDS'/>
    <Argument name='authorized' value='true'/>
    <Argument name='Form' value="Empty Form"/>
    <Variable name='view'/>
    <Return from='view' to='user'/>
    </Action>
    <Action id='2' name='Add Attribute'>
    <expression>
    <block>
    <set name='applicationuserid'>
    <invoke name='get'>
    <split>
    <ref>userid_applicationid</ref>
    <s>#</s>
    </split>
    <i>0</i>
    </invoke>
    </set>
    <set name='resourcename'>
    <invoke name='get'>
    <split>
    <ref>userid_applicationid</ref>
    <s>#</s>
    </split>
    <i>1</i>
    </invoke>
    </set>
    <set name='user.waveset.resources'>
    <appendAll>
    <ref>user.waveset.resources</ref>
    <list>
    <s>RACF</s>
    </list>
    </appendAll>
    </set>
    <set>
    <concat>
    <s>user.accounts[</s>
    <ref>resourcename</ref>
    <s>].created</s>
    </concat>
    <s>true</s>
    </set>
    <set>
    <s>waveset.accounts[RACF].id</s>
    <get>
    <invoke name='getObject'>
    <invoke name='getLighthouseContext'>
    <ref>WF_CONTEXT</ref>
    </invoke>
    <s>Resource</s>
    <s>RACF</s>
    <Map>
    <MapEntry key='action' value='update'/>
    </Map>
    </invoke>
    <s>id</s>
    </get>
    </set>
    <set>
    <concat>
    <s>user.accounts[</s>
    <s>RACF</s>
    <s>].name</s>
    </concat>
    <s>RACF</s>
    </set>
    <set>
    <concat>
    <s>user.accounts[</s>
    <ref>resourcename</ref>
    <s>].gapracfid</s>
    </concat>
    <ref>applicationuserid</ref>
    </set>
    <set>
    <concat>
    <s>user.accounts[</s>
    <ref>resourcename</ref>
    <s>].identity</s>
    </concat>
    <concat>
    <s>uid=</s>
    <ref>applicationuserid</ref>
    <s>,ou=racf,ou=Applications,dc=gap,dc=com</s>
    </concat>
    </set>
    <set>
    <concat>
    <s>user.accounts[</s>
    <ref>resourcename</ref>
    <s>].firstname</s>
    </concat>
    <ref>user.accounts[Lighthouse].firstname</ref>
    </set>
    <set>
    <concat>
    <s>user.accounts[</s>
    <ref>resourcename</ref>
    <s>].lastname</s>
    </concat>
    <ref>user.accounts[Lighthouse].lastname</ref>
    </set>
    <set>
    <concat>
    <s>user.accounts[</s>
    <ref>resourcename</ref>
    <s>].fullname</s>
    </concat>
    <ref>user.accounts[Lighthouse].fullname</ref>
    </set>
    </block>
    </expression>
    </Action>
    <Action id='3' name='Check In User View' application='com.waveset.session.WorkflowServices'>
    <Argument name='op' value='checkinView'/>
    <Argument name='view' value='$(user)'/>
    <Argument name='authorized' value='true'/>
    <Argument name='Form' value="Empty Form"/>
    </Action>
    <Transition to='end'/>
    <WorkflowEditor x='244' y='48'/>
    </Activity>
    When i run this in the IDM I can see all the entries but only first one is actually created on the target resource. When I open the user object in IDM and hit Save button IDM creates the accounts on the target system.
    I have already tried by using the refresh view just before the checkin view action but no luck..
    Any help for solving this problem would be appreciated.
    Thanks

    Thanks for the reply... in my case this would be done by the active synch process so no GUI form is required. I will be getting a list of application ID for the user by LDAP AS. One i get it i will have to parse it and get the list of application user id. I am passing those ID;s to a workflow where I am forming the resource name as you mentioned
    for example:
    If i get user1#user2#user3 from AS i am separating them based on # using split and getting 3 different user id;s
    now i am forming a string with the resource name and passing it to the sub process in which i am checking out the user object, setting the user attributes and checking in the new view.
    user1#LDAP
    user2#LDAP|1
    user3#LDAP|2
    Problem ; When i run this user1 is getting created in LDAP but user2 and user3 are not. There entry is getting created in IDM.
    When I open the IDM object I get a yellow triangle (warning) and if I open the user object and hit save button IDM creates the user account on the LDAP.
    any help for further solving this problem would be appreciated.
    Regards,

Maybe you are looking for

  • My name is displayed incorrectly when I send email from my ipad.  How do I change it?

    When I send an email from my iPad, my last name is spelled incorrectly.  Please advise. 

  • Bmp pictures not shown in ichat

    My friend keeps sending me bmp pictures over ichat, but they only show up as that page icon. I can drag it to the desktop, get info, and add the bmp extension to it, and it opens in preview fine, but it just doesn't show up in ichat. Is this a bug, o

  • How do I get my playlists from macbook to iphone?

    I used to connect the phone to the computer and then my playlists or songs were updated. Now, nothing. The phone stays the same and the laptop stays the same although it says it has synced. Thank you in advance for your help.

  • Doubt About HTTP To File

    Hi Expers, I have one doubt. If iam Developing the scenario HTTp To File Then do we need Any RFC Connection. When Do We need RFC Connection In case if we r implementing with HTTP Please clear me. Regards Khanna

  • RMAN don't take the device

    Hello here is my environment, Server: Hardware HP ML350 G5 / Intel QC E5320 @ 1.86GHz Tape: HP 960 / Ultrium 3-SCSI Firmware G64D OS SLES 9 SP3 Kernel : 2.6.5-7.244-smp #1 SMP Mon Dec 12 18:32:25 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux Oracle Version