Search Results

Search found 159 results on 7 pages for 'srikanth rongali'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • When we should use NSThreads in a cocoa Touch ?

    - by srikanth rongali
    I am writing a small game by using cocos2d. It is a shooting game. Player on one side and enemy on other side. To run the both actions of player shooting and enemy shooting do we should use threads ? Or can we do without using them. At present I am not using threads. But I can manage to do both actions of player and enemy at same time. Should I use threads compulsory good performance ? Or am I doing wrong without using threads ? Please help me from this confusion. Thank you.

    Read the article

  • How can we make the text to appear in landscape mode in cocos2d by using UITextView ?

    - by srikanth rongali
    I want a UITextView in cocos2d. I used in init method UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0,0, windowSize.height/2,windowSize.width/2)]; textView.backgroundColor = [UIColor clearColor]; textView.text = @"I am First enemy"; [textView setEditable:NO]; [[[CCDirector sharedDirector]openGLView]addSubview:textView]; the orientation is [[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft]; I need the text to appear in landscape mode, but I am getting the text in following way. How can I make the text to appear in the landScape mode. I am working in cocos2d. CanOI scroll the text ? What should i add to make the text scroll up and down. Thank you.

    Read the article

  • Do, custom fonts work in UITextView that was loaded in cocos2d layer ?

    - by srikanth rongali
    Do, custom fonts work in UITextView ? I loaded UITextView *textView in cocos2d layer. And I trying to set the font of the text as Copperplate Gothic Bold. I downloaded the font file Coprgtb.TTF. But, the text is not adjusting to this font. The system fonts are working, but the custom fonts are not working ? I added the font file in resources folder. what can I do to make them work ? Thank You.

    Read the article

  • Writing the code by dividing it into more files in cocoatouch.

    - by srikanth rongali
    My problem is, I need a background image, a sprite(with animation) on left edge, another sprite(with animation) at other edge, a number count animation 1-2-3 at middle. I got all these when I wrote all in same file.(like [self addChild:label], [self addChild:sprite].., But in this it needs touch enables for both sprites separately, and touchDisabled to the remaining screen. So thought of writing in different files. But now it is not working. I kept one sprite, background image, numbercount in one file and another spritr in other file. Either I am getting the second sprite or the (sprite+background+numberCount) is displayed. This is my problem. plz give me solution. Thank You

    Read the article

  • How to use the variable declared in one class in another class in Obj C.

    - by srikanth rongali
    I have a NSDate *date1 in class1 implementation file(I initialized it as Global variable). I have NSDate *date2 in class 2 implementation file (initialized it as Global variable). I need to calculate the NSTimeInterval between the two dates in class 2. But I could not do it. I could not access date1 in this class. It is giving error as (date2 undeclared). Please give me help in how to call other class variables in this class. Thank you.

    Read the article

  • Writing the code iby dividing it into more files.

    - by srikanth rongali
    My problem is, I need a background image, a sprite(with animation) on left edge, another sprite(with animation) at other edge, a number count animation 1-2-3 at middle. I got all these when I wrote all in same file.(like [self addChild:label], [self addChild:sprite].., But in this it needs touch enables for both sprites separately, and touchDisabled to the remaining screen. So thought of writing in different files. But now it is not working. I kept one sprite, background image, numbercount in one file and another spritr in other file. Either I am getting the second sprite or the (sprite+background+numberCount) is displayed. This is my problem. plz give me solution. Thank You

    Read the article

  • How to delete a customized cell in UITableView ?

    - by srikanth rongali
    I have UITableView. I customized the cell height (increased). I have 4 labels(UILabel) and 1 image(UIImage) and 3 buttons (UIButton). one of the button is delete button. By touching the cell or button(play button) on the image a video is loaded and played. I need to delete the cell by touching delete button. If I touched the delete button the corresponding video is deleted from library . But, how to delete the cell and all remaining data in it ? I am not able to delete the cells or the data in the cells. How to do it ? Thank you.

    Read the article

  • How can I play video by touching the button on the video image of the video in tableviewcell ?

    - by srikanth rongali
    I have a table view in which if each cell is touched video plays. Each cell have image of the video cell.imageView.image. And on the image I have a button (UIButton) with play symbol. If I touch the play button the corresponding video should be played same like the when cell is touched. I have a selector for the play button. How can I relate the corresponding cell to the play button. Thank You.

    Read the article

  • How to use tags in iPhone application code ?

    - by srikanth rongali
    I need to access the [indexPath row] outside the tableView method. I need to use it in my own method in same class and other classes also. How can I do it. If the cell in the table view have buttons, By selecting the buttons how can I say which row was selected ? I think of using the tags. But, I do not know much about tags. Thank you.

    Read the article

  • How can I delete video stored in the photo library ?

    - by srikanth rongali
    I have saved video in to the photo library. -(void)exportVideo:(id)sender { NSString *path = [DOCUMENTS_FOLDER stringByAppendingString:@"/air.mp4"]; NSLog(@"Path:%@", path); NSLog(@"Export Button CLicked"); UISaveVideoAtPathToSavedPhotosAlbum(path, self, @selector(video:didFinishSavingWithError: contextInfo:), nil); } - (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo { NSLog(@"Finished saving video with error: %@", error); } Now I need to delete the video i have stored programmatically. How can I delete the video ? Are there any functions for it? Thank You.

    Read the article

  • How can I make the keyboard disappear after entering the text ?

    - by srikanth rongali
    I have two text fields in my view. I did it using IB. My problems are After entering the text in textField1 I am entering text in textField2. When I click in textField1 again the previous text is disappeared in the textField1. After entering the text in both the textFields, I need the keyboard to disappear. But, even I touched the return key in the keyboard layout or I touched the screen outside the text field the keyboard is not disappearing. How can I make this. Thank you.

    Read the article

  • I could not understand where the memory is leaking in my code ?

    - by srikanth rongali
    I have the following code. I do not understand the problem in it. Whenever I include this class in my class the code is going to infinite loop. I could not get where I am wrong. please help me. Just point the errors in the code. #import "readFileData.h" #import "DuelScreen.h" @implementation readFileData @synthesize enemyDescription, numberOfEnemies, numberOfValues; @synthesize enemyIndex, numberOfEnemyGunDrawImages, numberOfEnemyGunFireImages, numberOfEnemyDieImages; @synthesize countDownSpeed, enemyGunDrawInterval, enemyGunFire, enemyRefire; @synthesize enemyAccuracyProbability, enemyGunCoordinateX, enemyGunCoordinateY; -(id)init { if( (self = [super init]) ) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"enemyDetals.txt"]; NSString *contentsOfFile = [[NSString alloc ]initWithContentsOfFile:path]; NSArray *lines = [contentsOfFile componentsSeparatedByString:@"#"]; numberOfEnemies = [lines count]; int nEnemy; nEnemy = 0; NSArray *eachEnemy=[[lines objectAtIndex:nEnemy] componentsSeparatedByString:@"^"]; DuelScreen *enemyNumber1 = [[DuelScreen alloc] init]; NSLog(@"tempCount value in: readFile: %d", enemyNumber1.tempCount); enemyIndex = enemyNumber1.tempCount - 1; countDownSpeed = [[eachEnemy objectAtIndex:0]intValue]; enemyGunDrawInterval = [[eachEnemy objectAtIndex:1]floatValue]; enemyGunFire = [[eachEnemy objectAtIndex:2]floatValue]; enemyAccuracyProbability = [[eachEnemy objectAtIndex:3]floatValue]; enemyRefire = [[eachEnemy objectAtIndex:4]floatValue]; numberOfEnemyGunDrawImages = [[eachEnemy objectAtIndex:5]intValue]; numberOfEnemyGunFireImages = [[eachEnemy objectAtIndex:6]intValue]; numberOfEnemyDieImages = [[eachEnemy objectAtIndex:7]intValue]; enemyGunCoordinateX = [[eachEnemy objectAtIndex:8]floatValue]; enemyGunCoordinateY = [[eachEnemy objectAtIndex:9]floatValue]; enemyDescription = [eachEnemy objectAtIndex:10]; } return self; } @end

    Read the article

  • Problem with accessing classes from another class.

    - by srikanth rongali
    I have a classA, classB,classC. I have another class classABC; All are CCLayer inherited. I need to call all the classA, classB, classC from classABC. #import <Foundation/Foundation.h> #import "cocos2d.h" @interface classABC : CCLayer { classA *aClass; } @property(nonatomic, retain)classA *aClass; @end #import "classABC" #import "classA.h" #import "classB.h" #import "classC.h" @implementation classABC -(id)init { if( (self = [super init]) ) { ClassA *aClass = [[ClassA alloc]init]; CCScene *aClassS = [CCScene node]; CCLayer * aClassL = [aClass node]; [aClassS addChild: aClassL]; [[CCDirector sharedDirector] setAnimationInterval:60.0/60]; [[CCDirector sharedDirector] replaceScene: aClass]; } return self; } @end But I am not getting the classA displayed. How should I do it ? Thank You.

    Read the article

  • How can we detect a touch of a sprite?

    - by srikanth rongali
    I have two sprites in my app. Both should have touches enabled and both touches are independent of one another. And if I touch the screen (not on sprites) it should have different touches. My problem is all three sprite1, sprite2, remaining screen should have independent touches. But my program is taking all the touches as same. How can I make them as what I needed ? Thank You.

    Read the article

  • How to call a method in init method ?

    - by srikanth rongali
    My program looks like this: -(id)init { if ( (self = [super init]) ) { //TargetWithActions *targetActions= [[TargetWithActions alloc] init]; [self countDownSpeed123]; } return self; } -(void)countDownSpeed123 { countDownSpeed = 5.0f; } @end warning: 'TargetWithActions' may not respond to '-countDownSpeed123' I am getting the warning in this way. Where I am wrong in my program. Please explain ? Thank You.

    Read the article

  • When the current toolbar is touched previous toolbar items are activated.

    - by srikanth rongali
    I have a UIToolBar *toolbar1. I have 3 buttons on the toolbar. And the tool bar is at the bottom of the view. The buttons are like library button, moreApps button, recordVideo button. If I touch the library button a new view(a UITableViewController) appears. I used presentModelViewController for it. If I touch moreApps button a new view (a UIViewController) appears and it loaded from http//. The recordButton touch gives another UIViewController view. When the moreApps button is touched and the view is loaded, it have the content from web and a UIToolBar *toolbar2 at the bottom the view. It has a refresh button and done button. The problem is when I touch the toolbar2 (not on the refresh button and done button) the previous views button are activated and corresponding views of previous buttons(library button, playVideo button) are loaded. I am not able to understand about this problem. Thank you.

    Read the article

  • How can we know which cell is touched in tablView when a custom button in the cell is touched ?

    - by srikanth rongali
    I need to know which cell is touched when any button inside the cell is touched. I have custom UIButton *button1 in the cell and UIButton *button2 on the cell.imageView.image of the cell. I wrote selectors for both buttons.; But, I could not differentiate the buttons for each cell. How do I know which cell button was touched. What to do, to know that a particular cell's button was touched ? Thank you.

    Read the article

  • How can I dismiss the view appeared by touching Add item in UINavigationController ?

    - by srikanth rongali
    I have added add(+ symbol button) button to my navigation controller. When I click it a view appears from bottom. I added a navigation bar and two buttons to it. One save and one cancel button. And the view have one textEdit box. After editing I can save or cancel. If I touch cancel I need the view to disappear like it should go down again. I think all iPhone , iPodTouch users use it. Like when they touch Add item then a view appears from bottom and when they cancel it goes down again. How can I make in this way in my application.

    Read the article

  • How can I differentiate two different touches on a layer ?

    - by srikanth rongali
    I am writing an app in cocos2d. I hava a sprite and a text in my scene. I have written two separate classes for sprite and text. And I added both of them to another class. In sprite class I have written - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event And in text class I have written -(void) registerWithTouchDispatcher { [[CCTouchDispatcher sharedDispatcher]addTargetedDelegate:self priority:0 swallowsTouches:YES]; } -(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event { return YES; } -(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event { NSLog(@"Recognized tOuches in Instructions");// CGSize windowSize = [[CCDirector sharedDirector] winSize]; CCNode *node = [self getChildByTag:kTagNode]; [node setPosition: ccp(text1.contentSize.width/2,text1.contentSize.height/2 - windowSize.height)]; } -(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event { CGPoint touchLocation = [touch locationInView: [touch view]]; CGPoint prevLocation = [touch previousLocationInView: [touch view]]; touchLocation = [[CCDirector sharedDirector] convertToGL: touchLocation]; prevLocation = [[CCDirector sharedDirector] convertToGL: prevLocation]; CGPoint diff = ccpSub(touchLocation,prevLocation); CCNode *node = [self getChildByTag:kTagNode]; CGPoint currentPos = [node position]; [node setPosition: ccpAdd(currentPos, diff)]; } But, only touches in the text are recognized and touch of sprite is not recognized ? How can I differentiate the two touches.

    Read the article

  • how can I store the current status of the game in cocos2d ?

    - by srikanth rongali
    I am writing a shooting game in cocos2d. And each enemy enters the screen after the current one is dead. I have stores the enemies and their properties in plist. I need to save the current state of the game. If any phone call comes the game should be started from the current state. So, I usedNsUserDefaults in this way, - (void) applicationDidFinishLaunching:(UIApplication*)application { ... NSUserDefaults *myDefaultOptions = [[myDefaultOptions stringForKey:@"enemyNumber"]intValue] ; //tempCount4 is the current Enemy number. It was declared in another class. I am using extern and using the value here. tempCount4 = [[myDefaultOptions stringForKey:@"enemyNumber"]intValue] ; } - (void)applicationWillTerminate:(UIApplication *)application { [[CCDirector sharedDirector] end]; [myDefaultOptions setObject:tempCount4 forKey:@"enemyNumber"]; } The control is not entering in to the (void)applicationWillTerminate:(UIApplication *)application when I pressed the Home button. And when I touched the game icon on the screen the game is running from first screen and in log (terminal )it is not showing any values. And what should I store to resume my game from stored state. Can you explain where I was wrong ? Thank You.

    Read the article

  • can I store an id value in array of float type ?

    - by srikanth rongali
    I used, for(id value in values) to get the value from an NSArray. Now I want to store it in 2 dimensional float array[][]. When I try to assign the values to array it is giving error:incompatible types in assignment. I tried to cast the value but I got error: pointer value used where a floating point value was expected. I need to store the values in an 2 dimensional array . How can I make it ? Thank You. @implementation fromFileRead1 NSString *fileNameString; int numberOfEnemies, numberOfValues; -(id)init { if( (self = [super init]) ) { NSString *path = @"/Users/sridhar/Desktop/Projects/exampleOnFile2/enemyDetals.txt"; NSString *contentsOfFile = [[NSString alloc] initWithContentsOfFile:path]; NSArray *lines = [contentsOfFile componentsSeparatedByString:@"\n"]; numberOfEnemies = [lines count]; NSLog(@"The number of Lines: %d", numberOfEnemies); for (id line in lines) { NSLog(@"Line %@", line ); NSString *string1 = line; NSArray *split1 = [string1 componentsSeparatedByString:@","]; numberOfValues = [split1 count]; NSLog(@"The number of values in Row: %d", numberOfValues); for (id value in split1) { NSLog(@"value %@", value); float value1; value1 = [split1 objectAtIndex:2]); NSLog(@"VAlue of Value1 at index 2: %f", value1 ); } } } return self; } @end In enemyDetal.txt I have 1,3,3 2,3,2.8 10,2,1.6

    Read the article

  • How can I set different sound for different players by using [[SimpleAudioEngine sharedEngine] playE

    - by srikanth rongali
    I need to set sounds for different players in my game. There are 10 players. And I have 10 sounds. The players are loaded int his way for( int i = 1; i <5; i++ ) { [playerAnimation addFrameWithFilename: [NSString stringWithFormat:@"Player %02d gun draw_%02d.png", playerNumber, i]]; } How can I set the sounds in this way by giving the filenames. And player1 shoots player1sound should play. How can I do it using [[SimpleAudioEngine sharedEngine] playEffect:@"player1.sound.wav"];

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >