Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

checkbox button on iPhone application

pdmpdm Posts: 56Registered Users
Hi,

You can call me dumb, but I am going to ask this question anyway. I want to add a checkbox button onto my application.

I can see other controls like "Round Rect Button", TextField etc. But I can't see a checkbox control for iPhone in IB.

Can anybody please tell me how to I add a checkbox button to my iPhone application using IB.

Once it's added I should be able to collect the data thats been checked using the checkbox and store it in some buffer.

Are there any sample examples to achieve the above functionality?

Thanks for any help in advance!

pdm
Post edited by pdm on

Replies

  • h2hh2h Posts: 38Registered Users
    pdm;23511 said:
    Hi,

    You can call me dumb, but I am going to ask this question anyway. I want to add a checkbox button onto my application.

    I can see other controls like "Round Rect Button", TextField etc. But I can't see a checkbox control for iPhone in IB.

    Can anybody please tell me how to I add a checkbox button to my iPhone application using IB.

    Once it's added I should be able to collect the data thats been checked using the checkbox and store it in some buffer.

    Are there any sample examples to achieve the above functionality?

    Thanks for any help in advance!

    pdm
    Well in IB you could use the on/off switch but if you want a "traditional" checkbox there is no way around in implementing your own checkbox...

    greetings h2h
    Atomium Pro - Professional Periodic Table - $4.99

    <a href="http://itunes.apple.com/us/app/molecular-mass-calculator/id364920984?mt=8" target="_
  • Craig2Craig2 Posts: 36Tutorial Authors, Registered Users
    Personally I just have 2 images and change/hide them depending on whether the user clicks it or not, works just as well but its slightly more work than just using the on/off switch
  • pdmpdm Posts: 56Registered Users
    Hi guys,
    Thanks for your reply.. is there any alternate solution to get that functionality done.

    All i need is to select couple of data by choice and store it in some buffer, it's like selecting multiple mails using Ctrl+C in windows.

    Thanks,
    pdm
  • StatCoderStatCoder Posts: 221Registered Users
    There really isn't a checkbox in the official iPhone user interface. Nor is there a popup trigger/pulldown list. I think you are supposed to use tables that have a check mark in the cell or the on/off switch.

    I wonder how picky the App Store reviewers are about apps that don't follow the guidelines in the user interface manual. There have been issues with buttons that were not located on toolbars. The Settings view in the iPhone uses nested tables with ON/OFF switches. I think that's a hint. It's obvious that they don't want developers to use these kinds of controls but the question is how far will they go to prohibit them?

    I'd like to use a checkbox or button that changes image when "pushed in" also. Perhaps someone here can point to an app in the App Store that has an example of these or can post some sample routines that can be called. It would be preferable if these had made it through the App Store review process.
    STAT ICD-9 LITE|<a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=291155883&mt=8" target="_blank
  • gagandeepbgagandeepb Posts: 88Registered Users
    there is a control in sdk UISegmentControl which is used in place of checkboxes u have to use its Value change event.
    Hope this will help.
  • StatCoderStatCoder Posts: 221Registered Users
    In the UICatalog sample, UISegmentedControl example seems to allow only one button to be selected in each bar. And, a touched button does not release when you touch it again. This wouldn't act like three checkboxes side by side. However, if you could deselect a button by touching it that would work. I'm reading that this control doesn't act that way. It only triggers an event when the value has changed (another button in the bar is selected).
    STAT ICD-9 LITE|<a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=291155883&mt=8" target="_blank
  • farshadmbfarshadmb Posts: 35Registered Users
    U can use this code to Simulate must look like in the iphone tableView
    i use this code for my app! and work nicly!
    - (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
    return ([indexPath isEqual:SingleSelection]) ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
    }
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section==1){
    //[tableView cellForRowAtIndexPath:self.SingleSelection].accessoryType = UITableViewCellAccessoryNone;
    //[tableView cellForRowAtIndexPath:self.SingleSelection].selected=NO;
    if( [tableView cellForRowAtIndexPath:indexPath].accessoryType==UITableViewCellAccessoryNone){
    SelectCounter+=1;
    [tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark;
    //[tableView cellForRowAtIndexPath:indexPath].selected=YES;
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    }else
    { SelectCounter-=1;
    [tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryNone;
    //[tableView cellForRowAtIndexPath:indexPath].selected=NO;
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    ;);)
  • thanhbvthanhbv Posts: 1New Users
    Here, Wyvwyv say that:
    I ended up creating my own UICheckbox control and stole the checkbox graphics from OS X. I subclassed a UIButton and made the button action toggle its own selected state.
    But i don't know how to do that.
    Pls someone help me.....
  • mike62mike62 Posts: 6New Users
    I found this post, and a couple others, on this topic and dug into it a bit since I need checkboxes too. Have a look at my tutorial on how to create a simple checkbox in Interface Builder. There is source code in the form of a working Xcode project. Let me know how it goes!
  • orange goldorange gold Posts: 690Registered Users
    you could have 2 UIImageViews one with a box then ontop of that one with a check... the check is defaultly hidden, make an intiger called isClicked;
    now when the user presses the image (remember to enable user interaction in your xib file) say

    if (isClicked == 0) {
    checkedImage.hidden = NO;
    isClicker = 1;
    }
    else if (isClicked == 1) {
    checkedImage.hidden = YES;
    isClicker = 0;
    }


    that way if it is unchecked it will become checked and if it is checked it will become unchecked
    APPS4LIFE

    search for me in the app store.
  • winuxworxwinuxworx Posts: 1New Users
    Hello,

    Perhaps Apple has gone through a thorough research on how to make user interface work best for iOS devices and they made up their minds to remove the check box item for the ff reasons I also agree.

    Check box can be triggered easily by a "click" using a mouse when using Personal Computers. However, the story becomes different when used in a touch screens like iOS devices.

    You might argue and say "What's the difference of tapping a check box from tapping a button? We never had a problem with a UIButton".

    Yes that's true. The problem of including a check box in iOS interface IS NOT ONLY about "tapping" but the space required for a finger to FIT and accurately tap inside the check box area.

    Usually buttons are much bigger in space and is more isolated (fewer control items are surrounding it) compared to check boxes. On the other hand, check boxes are usually contained inside a TIGHT "configuration window" together with the other control items. In effect, you'll end up accidentally tapping the other controls beside it.

    Possible solution is to make the check boxes a little bigger but your sacrificing the available space and making it look too crowded and probably, Apple finds large check boxes unpleasing (i don't know as Aesthetics is very important to this guys).

    Apple Solution:
    Replace the check box with a UISwitch for the ff reasons:

    UISwitch is
    1) very accurate and works perfectly in tight "configuration window" since you have to swipe your finger instead of tapping it.
    2) small in size (in terms of height) compared to buttons. It doesn't need to be taller to make swiping more accurate. In effect, you can fit more controls vertically.
    3) very intuitive It relates to the real world on/off switch objects (ex light switch) and maintains simplicity (which is one of Apples design principles).
  • BrixBrix Posts: 149Registered Users
    winuxworx;417017 said:

    UISwitch is
    1) very accurate and works perfectly in tight "configuration window" since you have to swipe your finger instead of tapping it.
    2) small in size (in terms of height) compared to buttons. It doesn't need to be taller to make swiping more accurate. In effect, you can fit more controls vertically.
    3) very intuitive It relates to the real world on/off switch objects (ex light switch) and maintains simplicity (which is one of Apples design principles).
    1. You can toggle a UISwitch by just tapping.
    2. In terms of size, did you see the UIButtonTypeInfoLight, it's small but you can still tap on it accurately. Which means you can do the same with checkbox.
    3. no comment.
    Praise be to God
Sign In or Register to comment.