The ModMyTM Family of Sites:
ModMyMotoModMyiModMyGphone




 
 
Register or Connect with Facebook

Discuss AppStore Apps | Browse / Search Cydia | MMi Cydia Stats




  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 05-25-2008, 09:03 AM
What's Jailbreak?
 
Join Date: May 2008
Posts: 9
Thanks: 0
Thanked 1 Time in 1 Post
[questions] SegmentedControl, NSString, Right button

I am using toolchain to develop an application, but currently I've hit some obstacles. I have several questions and hope you guys can give me some pointers:

1) How to determine if the user has selected a segment in a UISegmentedControl? The selectedSegment method will give segmentation fault at run time if I don't select any segment, and apparently there is not an isSelected method or something similar in the UISegmentedControl.h

2) I want to make sure that my string only contains digits and alphabets. For now my only solution is to do a "find string within string" operation for all special characters I can think of, but it surely is not the most elegant solution out there. Anyone has a better idea? Is there a way to disable special characters in the keyboard, or to trim them all off my string?

3) How to make the rightButton beside a UITextField to appear? I can make the clear button to appear by calling setClearButtonStyle, but setRightButtonStyle doesn't work, and setRightButton doesn't seem to exist.

Thank you
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #2  
Old 05-26-2008, 02:21 AM
NetMage's Avatar
Developer
 
Join Date: Aug 2007
Device + Firmware: iPhone 2.2.0
Operating System: Windows XP / OS X
Location: Virginia
Posts: 1,231
Thanks: 45
Thanked 202 Times in 162 Posts

For #1, this seems to imply you can use setDelegate: and get a segmentedControl:selectedSegmentChanged: message:

#91844 - Pastie

For #2, you could filter strings with a help message like this:
Code:
@implementation NSString (SCW)

- (NSString*) stringWithCharactersInSet: (NSCharacterSet*)aSet {
    NSScanner *sc = [NSScanner scannerWithString: self];
    NSMutableString *ans = [NSMutableString stringWithCapacity: (int)([self length]*0.9)];

    while (![sc isAtEnd]) {
	NSString *work = @"";
	if ([sc scanCharactersFromSet: aSet intoString: &work])
	    [ans appendString: work];

	[sc scanUpToCharactersFromSet: aSet intoString: NULL];
    }

    return [NSString stringWithString: ans];
}

@end

Last edited by NetMage; 05-26-2008 at 02:25 AM..
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
Reply

  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion

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



Go to Top
ModMyI

All times are GMT -6. The time now is 02:24 AM. Powered by vBulletin® Version 3.8.4
If you need Dedicated Server Hosting, you should check out SingleHop. | Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 Copyright © 2007-09 by ModMy, LLC. All rights reserved.

iPhone News / iPhone Forums / Apple News / Apple Forums / RSS / Contact Us / / Top