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 10-13-2008, 05:49 AM   #1 (permalink)
pdm
New Member
 
Join Date: Aug 2008
Posts: 56
pdm is on a distinguished road
Default checkbox button on iPhone application

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
pdm is offline   Reply With Quote
Old 10-13-2008, 06:01 AM   #2 (permalink)
h2h
Registered Member
 
Join Date: Aug 2008
Posts: 38
h2h is on a distinguished road
Default

Quote:
Originally Posted by pdm View Post
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
h2h is offline   Reply With Quote
Old 10-13-2008, 06:15 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2008
Posts: 36
Craig2 is on a distinguished road
Default

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
Craig2 is offline   Reply With Quote
Old 10-13-2008, 07:05 AM   #4 (permalink)
pdm
New Member
 
Join Date: Aug 2008
Posts: 56
pdm is on a distinguished road
Default

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
pdm is offline   Reply With Quote
Old 10-13-2008, 07:15 AM   #5 (permalink)
Physician developer
 
StatCoder's Avatar
 
Join Date: Aug 2008
Location: Austin, TX
Posts: 221
StatCoder is on a distinguished road
Default

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.

Last edited by StatCoder; 10-13-2008 at 07:24 AM.
StatCoder is offline   Reply With Quote
Old 10-13-2008, 08:40 AM   #6 (permalink)
Registered Member
 
Join Date: Sep 2008
Posts: 88
gagandeepb is on a distinguished road
Default

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.
gagandeepb is offline   Reply With Quote
Old 10-13-2008, 09:03 AM   #7 (permalink)
Physician developer
 
StatCoder's Avatar
 
Join Date: Aug 2008
Location: Austin, TX
Posts: 221
StatCoder is on a distinguished road
Default

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).
StatCoder is offline   Reply With Quote
Old 02-05-2009, 12:04 PM   #8 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 35
farshadmb is on a distinguished road
Default Reply of CheckBox button

U can use this code to Simulate must look like in the iphone tableView
i use this code for my app! and work nicly!
Code:
- (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];
farshadmb is offline   Reply With Quote
Old 05-14-2009, 04:16 AM   #9 (permalink)
New Member
 
Join Date: May 2009
Posts: 1
thanhbv is on a distinguished road
Default

Here, Wyvwyv say that:
Quote:
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.....
thanhbv is offline   Reply With Quote
Old 06-04-2009, 02:15 PM   #10 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: Winnipeg, Canada
Posts: 6
mike62 is on a distinguished road
Lightbulb Tutorial on a simple checkbox in Interface Builder

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!
mike62 is offline   Reply With Quote
Old 06-04-2009, 02:22 PM   #11 (permalink)
Gold Orange
 
orange gold's Avatar
 
Join Date: Sep 2008
Posts: 686
orange gold is an unknown quantity at this point
Default

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
Code:
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
orange gold is offline   Reply With Quote
Old 03-13-2012, 01:22 PM   #12 (permalink)
Registered Member
 
Join Date: Oct 2011
Posts: 1
winuxworx is on a distinguished road
Default Only my opinion and PROBABLY Apple's as well.

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).
winuxworx is offline   Reply With Quote
Old 03-13-2012, 07:59 PM   #13 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 149
Brix is on a distinguished road
Default

Quote:
Originally Posted by winuxworx View Post
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
Brix is offline   Reply With Quote
Reply

Bookmarks

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: 323
7 members and 316 guests
anothermine, Chickenrig, Domele, givensur, michaelhansen, PixelInteractive, Sloshmonster
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,892
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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