If you get the error “warning:comparison between pointer and integer”, odds are you are thinking right, but implementing your comparison wrong.
ur doin it wrong
if(count == 2) {
the right way
if([count intValue] == 2) {
If you get the error “warning:comparison between pointer and integer”, odds are you are thinking right, but implementing your comparison wrong.
ur doin it wrong
if(count == 2) {
the right way
if([count intValue] == 2) {
Recently while developing an app, I ran into an issues where the iPhone keyboard was sliding up and covering the text field. I did some quick searching on the on the internet an came across some sample code on StackOverflow (http://stackoverflow.com/questions/1247113/iphone-keyboard-covers-text-field)
I took the code that was given and spun it for my own uses. After placing the code in the project, I linked the hidden textFields ‘Editing Did Begin” and “Editing Did End” events to the “slideFrameUp” and “slideFrameDown” methods.
The end result works great!
-(IBAction) slideFrameUp;
{
[self slideFrame:YES];
}
-(IBAction) slideFrameDown;
{
[self slideFrame:NO];
}
-(void) slideFrame:(BOOL) up
{
const int movementDistance = 50; // tweak as needed
const float movementDuration = 0.3f; // tweak as needed
int movement = (up ? -movementDistance : movementDistance);
[UIView beginAnimations: @"anim" context: nil];
[UIView setAnimationBeginsFromCurrentState: YES];
[UIView setAnimationDuration: movementDuration];
self.view.frame = CGRectOffset(self.view.frame, 0, movement);
[UIView commitAnimations];
}
My latest iPhone app, VegScan, has enterd the beta phase!
VegScan is a social tool / game that scans bar codes of products and allows people to quickly identify if an item is vegan or vegetarian. You earn points and achievements with the more items you add to the community.
You can sign up for the beta program at www.VegScan.com
NSLog is a convenient way to output logging information from your iPhone app. NSLog is most commonly used by developers for debugging purposes. The problem with adding NSLog statements in your code is that you have to remove them or comment them out before you can submit your application to the app store. Apps that output data via NSLog will not be approved into the app store.
I would like to show you how I handle this delema. Start by opening the “_Prefix.pch” file.
next, add the following lines to the file
#define DEBUG_MODE
#ifdef DEBUG_MODE
#define DebugLog( s, ... ) NSLog( @"<%@:(%d)> %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define DebugLog( s, ... )
#endif
In your code, replace “NSLog” with “DebugLog”. THATS IT!
DebugLog adds some new functionality to NSLog. It will now output the file name and line number of the Debug statement.
The best part of this is that its very easy to disable when its time to create a release build of your code. Simple comment out the “#define DEBUG_MODE” line im the “_Prefix.pch” file.
This is a quick and dirty video of my first impressions of iPhone 4.0
[youtube]http://www.youtube.com/watch?v=ySAia7fDu_Q[/youtube]