Search Results

Search found 11 results on 1 pages for 'nextrev'.

Page 1/1 | 1 

  • For Loop Question?

    - by NextRev
    I'm programming an app for the iPhone. I'm not very good with loops just yet. How do I shorten this code into a for loop? if(CGRectContainsRect([space1 frame], [box frame])){ space1.image = [UIImage imageNamed:@"box.png"]; } else if(CGRectContainsRect([space2 frame], [box frame])){ space2.image = [UIImage imageNamed:@"box.png"]; } else if(CGRectContainsRect([space3 frame], [box frame])){ space3.image = [UIImage imageNamed:@"box.png"]; } else if(CGRectContainsRect([space4 frame], [box frame])){ space4.image = [UIImage imageNamed:@"box.png"]; } else if(CGRectContainsRect([space5 frame], [box frame])){ space5.image = [UIImage imageNamed:@"box.png"]; }

    Read the article

  • Switching xib's in iPhone SDK?

    - by NextRev
    I'm having issues with switching xib's when I try to from my second view into the third. I get into the second view from the first like this... -(IBAction)startButtonClicked:(id)sender{ Number2ViewController *screen = [[Number2ViewController alloc] initWithNibName:nil bundle:nil]; screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:screen animated:YES]; [screen release]; } But when I'm in the second view trying to get to the third view, the app crashes... -(IBAction)nextButtonClicked:(id)sender{ Number3ViewController *screen = [[Number3ViewController alloc] initWithNibName:nil bundle:nil]; screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:screen animated:YES]; [screen release]; } I know how to go into one view and then immediately back using [self dismissModalViewControllerAnimated:YES]; How do you just keep going to different views though without having to go back first?

    Read the article

  • Two PickerViews in save View issue?

    - by NextRev
    I'm trying to have 2 pickerviews in the same view. It works except for two things. If one pickerview has more rows than the other the app crashes when picking an item from the pickerview with more items. Also I created an NSLog for the pickerviews and the console shows that I'm picking two items at once when in fact i'm only dealing with one pickerview. I know it sounds a bit confusing but I'm including all the code. Thank you in advance. list and list2 are NSMutableArrays list has 4 items list2 has 5 items There error: * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (4) beyond bounds (4)' -(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView{ if([thePickerView isEqual:pickerView1 ]){ return 1; } else if([thePickerView isEqual:pickerView2]){ return 1; } else{ return 0; } } -(NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component{ if([thePickerView isEqual:pickerView1 ]){ return [list count]; } else if([thePickerView isEqual:pickerView2]){ return [list2 count]; } else{ return 0; } } -(NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{ if([thePickerView isEqual:pickerView1 ]){ return [list objectAtIndex:row]; } else if([thePickerView isEqual:pickerView2]){ return [list2 objectAtIndex:row]; } else{ return 0; } } - (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { NSLog(@"Selected item %@. Index of selected item:%i", [list objectAtIndex:row], row); NSLog(@"Selected item %@. Index of selected item:%i", [list2 objectAtIndex:row], row); NSLog(@"Selected item %@. Index of selected item:%i", [list3 objectAtIndex:row], row); if([thePickerView isEqual:pickerView1 ]){ //Do Something } else if([thePickerView isEqual:pickerView2 ]){ //Do Something } else if([thePickerView isEqual:pickerView3 ]){ //Do Something } }

    Read the article

  • iPhone UINavigation Controller issue?

    - by NextRev
    I have 3 different xib's. I am able to go back and forth between view 1 and view 2 with the following code... This Code brings up the second view... -(IBAction)startButtonClicked:(id)sender{ self.gamePlayViewController = [[GamePlayViewController alloc] initWithNibName:@"GamePlayViewController" bundle:nil]; [self.navigationController pushViewController:gamePlayViewController animated:YES]; [GamePlayViewController release]; } This Code is executed in the second view and brings me back to the first view... -(IBAction)backButtonClicked{ [self.navigationController popViewControllerAnimated:YES]; } Now when I try to execute this code (in the second view) to get to the third view...I get SIGABRT and the app crashes...why does it work for the first view bringing up the second view, but not for the second view bringing up the 3rd view? -(IBAction)nextView{ self.thirdViewController = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil]; [self.navigationController pushViewController:thirdViewController animated:YES]; [thirdViewController release]; }

    Read the article

  • touchesEnded Sound?

    - by NextRev
    I'm trying to play a sound on touchesEnded but I'm having a problem. There are multiple objects that get moved around, so if the below code holds true when any object is moved, it constantly plays the sound. How do I only play it once? -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ if(CGRectContainsRect([image1 frame], [image2 frame])){ [self playsound]; } }

    Read the article

  • Does this have to be released?

    - by NextRev
    I've done a lot of research on when it's correct to release things, but it's all confusing to me. I think sometimes the Leaks program is off. Anyway... background is a UIImageView background.image = [UIImage imageNamed:@"greenbackground.png"]; Do I have to release background? I never alloced it and it's not set as a property, so I'm thinking no.

    Read the article

  • Sliding finger UIImageView

    - by NextRev
    How do you detect when you slide your finger across a UIImageView? Say for example you slide your finger across it and it changes color or something. I want to be able to slide across multiple UIImageViews and have something happen...

    Read the article

  • If statement question iphone?

    - by NextRev
    I am creating a game where where you complete shapes and the area gets filled in. However, if there is an enemy bird within your shape, it will not fill in. I want to make it so that if you do trap a bird within your shape, you will lose a life. How can I write an if statement that pretty much says if the below code doesn't take place, then you lose a life. If it helps losing a life is called doDie in my code. -(void)fillMutablePath{ CGPoint movePoint = CGPointFromString([pointsToFillArray objectAtIndex:0]); CGPathMoveToPoint(fillPath, NULL, movePoint.x, movePoint.y); for (int i=0; i<[pointsToFillArray count]; i++) { CGPoint tempPoint = CGPointFromString([pointsToFillArray objectAtIndex:i]); CGPathAddLineToPoint(fillPath, NULL, tempPoint.x, tempPoint.y); } CGContextAddPath(gameViewObj._myContext, fillPath); CGContextFillPath(gameViewObj._myContext); CGPathRelease(fillPath); [pointsToFillArray removeAllObjects]; } if(fillMutablePath doesn't take place when making a shape){ [self doDie]; } Like i said above, the reason fillMutablePath wouldn't take place is because a bird would be trapped within the shape. Any help would be much appreciated!!

    Read the article

  • Can't get rid of this warning?

    - by NextRev
    I'm getting this warning "Format not a string literal and no format arguments? Any ideas? -(BOOL)isFirstPointReached{ NSString *firstPoint = [NSString stringWithFormat:[pointsToFillArray objectAtIndex:0]]; NSString *lastPoint = [NSString stringWithFormat:[pointsToFillArray lastObject]]; if([firstPoint isEqualToString:lastPoint]){ return YES; } else{ return NO; } }

    Read the article

1