Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.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 08-08-2009, 05:46 AM   #1 (permalink)
Registered Member
 
Frankie's Avatar
 
Join Date: Jun 2009
Location: San Antonio, TX
Posts: 104
Send a message via MSN to Frankie
Unhappy Why do I get "..."??????? I've done everything!!!

In my calculation i get this as the answer:

"..."

why do i get this??

also there's 2 different equations in each view of the tab bar.

Please Help!!!! I've done Everything!!!
Frankie is offline   Reply With Quote
Old 08-08-2009, 06:42 AM   #2 (permalink)
Registered Member
 
kelvinkao's Avatar
 
Join Date: Jul 2009
Location: Los Angeles
Posts: 352
Send a message via AIM to kelvinkao
Default

Uh, you are going to have to describe your problem better than that.
kelvinkao is offline   Reply With Quote
Old 08-08-2009, 11:47 AM   #3 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

The number is bigger than your UILabel?

Going to need a screenshot.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is online now   Reply With Quote
Old 08-08-2009, 03:52 PM   #4 (permalink)
Registered Member
 
Frankie's Avatar
 
Join Date: Jun 2009
Location: San Antonio, TX
Posts: 104
Send a message via MSN to Frankie
Default

There's two equations in each tab bar. I have it to where you enter in a number in a text field and enter in the second number with the UIPicker. Everything is linked correctly in IB. And my code looks about right but whenever it gives me the answer it comes up as ... instead of a number.
Frankie is offline   Reply With Quote
Old 08-08-2009, 04:07 PM   #5 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

Once again, a screenshot is going to go a long way in solving your problem.

Also, there are 2 possibilities:
1. Your data is wrong.
2. The display of your data is wrong.

A well-placed NSLog will help you figure out which situation you are in.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is online now   Reply With Quote
Old 08-08-2009, 04:20 PM   #6 (permalink)
Registered Member
 
Frankie's Avatar
 
Join Date: Jun 2009
Location: San Antonio, TX
Posts: 104
Send a message via MSN to Frankie
Default

Picture 6.jpg
Picture 7.jpg


OK here are some screens of my code from my first view
Frankie is offline   Reply With Quote
Old 08-08-2009, 05:48 PM   #7 (permalink)
Registered Member
 
Frankie's Avatar
 
Join Date: Jun 2009
Location: San Antonio, TX
Posts: 104
Send a message via MSN to Frankie
Default

here is the first view .m

Code:
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	billTotal.delegate = self;
	
	pickerViewArray = [[NSMutableArray alloc] init];
	for(int i = 1; i <= 20; i ++) { 
		NSString *myString = [NSString stringWithFormat:@"%d%", i]; 
		[pickerViewArray addObject:myString];
	}
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField { 
	[textField resignFirstResponder]; 
	return YES;}

#pragma mark -
#pragma mark Picker Data Source Methods
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView {
	return 1; //
}

- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component { 
	return [pickerViewArray count]; 
}
#pragma mark Picker Delegate Methods
- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
	return [pickerViewArray objectAtIndex:row];
}

- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { 
	tipSelected = row + 1;
	tipSelected = tipSelected;
	float tipTotal = tipSelected * 3.8 / [billTotal.text floatValue]; 
	tipAmount.text = [NSString stringWithFormat:@"Tip Level: %.2f%", tipTotal];

the second view is exactly like this only the calculation is different.
Frankie is offline   Reply With Quote
Old 08-08-2009, 07:29 PM   #8 (permalink)
Registered Member
 
Frankie's Avatar
 
Join Date: Jun 2009
Location: San Antonio, TX
Posts: 104
Send a message via MSN to Frankie
Default

Quote:
Originally Posted by BrianSlick View Post
Once again, a screenshot is going to go a long way in solving your problem.

Also, there are 2 possibilities:
1. Your data is wrong.
2. The display of your data is wrong.

A well-placed NSLog will help you figure out which situation you are in.
wat is NSLog and does my code help at all????
__________________
My new app that was recently featured in the App Store section: Soundsations
Creator of the most awesome app iWasted
Also Created the Audience app
Frankie is offline   Reply With Quote
Old 08-08-2009, 08:23 PM   #9 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

Quote:
Originally Posted by Frankie View Post
wat is NSLog and does my code help at all????
How have you done anything at all without knowing what NSLog is?

Ok, your screen shots are not appearing, so you'll need to host them somewhere else probably. I'm going to make a couple of guesses, but without seeing exactly what the problem is, it's a bit tough to be certain.

So, first of all, this line appears to be what sets the text for what I assume is a label or a text field:
Code:
tipAmount.text = [NSString stringWithFormat:@"Tip Level: %.2f%", tipTotal];
Are you literally seeing "..." or are you seeing "Tip Level: ..."? Please be specific.

Next, in order to find out if the issue is with the data or the display of the data, do something like this:

Code:
float tipTotal = tipSelected * 3.8 / [billTotal.text floatValue]; 
NSLog(@"tipTotal is: %f", tipTotal);
tipAmount.text = [NSString stringWithFormat:@"Tip Level: %.2f%", tipTotal];
View the log as you run your program. If this line produces the correct answer, then the issue is with the display of your data. If it doesn't, then your data is wrong.

Next, verify for your code. For example:
Code:
tipSelected = tipSelected;
This does nothing. Did you forget a + 1 or something? No idea what this was supposed to be, but as is it doesn't do anything.

Next, you need to be aware that special characters do certain things, especially the % sign. So when you are doing %d for an integer, or %f as you are here for the float, that % means something special. Because of that, you can't just stick a % in there and have it display as text. It is special, so you have to treat it as special. In this case, you have do to a double %% in order to get the display to be what you want (assuming you want something like 2.50% to appear). So your stringWithFormat line actually needs to look like:

Code:
tipAmount.text = [NSString stringWithFormat:@"Tip Level: %.2f%%", tipTotal];
Now I tested it as you have it here, and I never saw "..." in the log. I just saw the number without the % sign. So if you make the code changes I've indicated here, and you've verified that your data is correct, and it still isn't displaying correctly, then I still think that your label is too small. Make it bigger.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is online now   Reply With Quote
Old 08-08-2009, 09:07 PM   #10 (permalink)
Registered Member
 
Frankie's Avatar
 
Join Date: Jun 2009
Location: San Antonio, TX
Posts: 104
Send a message via MSN to Frankie
Talking

Quote:
Originally Posted by BrianSlick View Post
How have you done anything at all without knowing what NSLog is?

Ok, your screen shots are not appearing, so you'll need to host them somewhere else probably. I'm going to make a couple of guesses, but without seeing exactly what the problem is, it's a bit tough to be certain.

So, first of all, this line appears to be what sets the text for what I assume is a label or a text field:
Code:
tipAmount.text = [NSString stringWithFormat:@"Tip Level: %.2f%", tipTotal];
Are you literally seeing "..." or are you seeing "Tip Level: ..."? Please be specific.

Next, in order to find out if the issue is with the data or the display of the data, do something like this:

Code:
float tipTotal = tipSelected * 3.8 / [billTotal.text floatValue]; 
NSLog(@"tipTotal is: %f", tipTotal);
tipAmount.text = [NSString stringWithFormat:@"Tip Level: %.2f%", tipTotal];
View the log as you run your program. If this line produces the correct answer, then the issue is with the display of your data. If it doesn't, then your data is wrong.

Next, verify for your code. For example:
Code:
tipSelected = tipSelected;
This does nothing. Did you forget a + 1 or something? No idea what this was supposed to be, but as is it doesn't do anything.

Next, you need to be aware that special characters do certain things, especially the % sign. So when you are doing %d for an integer, or %f as you are here for the float, that % means something special. Because of that, you can't just stick a % in there and have it display as text. It is special, so you have to treat it as special. In this case, you have do to a double %% in order to get the display to be what you want (assuming you want something like 2.50% to appear). So your stringWithFormat line actually needs to look like:

Code:
tipAmount.text = [NSString stringWithFormat:@"Tip Level: %.2f%%", tipTotal];
Now I tested it as you have it here, and I never saw "..." in the log. I just saw the number without the % sign. So if you make the code changes I've indicated here, and you've verified that your data is correct, and it still isn't displaying correctly, then I still think that your label is too small. Make it bigger.
OMFG, You were right!!!! I effing love you.

My label was too small!!!! Now i feel retarded

Thank you a thousand times!!!!!
__________________
My new app that was recently featured in the App Store section: Soundsations
Creator of the most awesome app iWasted
Also Created the Audience app
Frankie is offline   Reply With Quote
Reply

Bookmarks

Tags
answer, calculation, tab bar, tab bar problem, view

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
» Stats
Members: 158,885
Threads: 89,229
Posts: 380,764
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

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