Search Results

Search found 15831 results on 634 pages for 'cocos2d iphone'.

Page 12/634 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • iPhone - how to pass an object to a button action

    - by Mike
    I have to pass an object to an button's action... something like [myButton addTarget:self action:@selector(sendIt:MY_OBJECT) forControlEvents:UIControlEventTouchDown]; I cannot set a variable and use that on the method because I am on a static class. How do I do that? thanks for any help.

    Read the article

  • iphone - mutableArray cannot store nil objects

    - by Mike
    I have a mutable array that is retained and storing several objects. At some point, one object may become nil. When this happens the app will crash, because arrays cannot have nil objects. Imagine something like [object1, object2, object3, nil]; then, object2 = nil [object1, nil, object3, nil]; that is not possible because nil is the end of array marker. So, how can I solve that? thanks for any help.

    Read the article

  • view .txt, .pdf files in iphone

    - by Ekra
    Hi friends, I am getting the data of the file from network and receiving it in NSData(not saving it any were). I want to view the files without saving it anywere. I tried it with UIWebView but with no success [webView loadData:data_ MIMEType:@"text" textEncodingName:@"UTF-8" baseURL:nil]; Any hint in right direction would be highly appreciated.

    Read the article

  • iphone - testing if an object exists

    - by Mike
    I have several apps in my app that can become nil at some point and I have methods that in theory are used to put these objects to nil. But, if I try to put to nil an object that does not exist, the app will crash. for example... [object1 release]; object1 = nil; //... and after that [object removeFromSuperview]; // this will crash Then I thought, why not testing to see if the object exists before removing... if (object1 != nil) [object removeFromSuperview]; // this will crash too, because object1 cannot be tested for nil because it does not exist How can I check if the object exists before testing if it is nil? something as if (object exists( { if(object != nil)) [object removeFromSuperview) } is this possible?

    Read the article

  • iphone - double tap fail safe way

    - by mike
    I am trying to detect double taps on a view, but when the double tap comes, the first tap triggers an action on TouchesBegan, so, before detecting a double tap a single tap is always detected first. How can I make this in a way that just detects the double tap? I cannot use OS 3.x gestures, because I have to make it compatible with old OS versions. thanks

    Read the article

  • iphone - forcing button to acknowledge touch programmatically

    - by Mike
    When you touch a UIButton it hides for a fraction of second and then it executes its action. This fast "blink" is the feedback the user needs to know that the button has been clicked. In the project I am doing, I need to select the button programmatically, as if the user had clicked it. In other words, the same behavior has the button had been clicked by the user... a fast blink and execution of its action. Is this possible? thanks for any help.

    Read the article

  • When iPhone Application Change Reflects

    - by Nirmal
    Hello... Fortunately our first application is in App Store now.. And in my itunesconnect account some of the fields are editable like screenshots, support url etc.. So, my question is if I update some of my screenshots or if I update the support url field when it will be reflects to itunes ? Or it will directly reflects once I update my current application ? Thanks in advance...

    Read the article

  • When iPhone Application Submitted Information Changes Reflects

    - by Nirmal
    Hello... Fortunately our first application is in App Store now.. And in my itunesconnect account some of the fields are editable like screenshots, support url etc.. So, my question is if I update some of my screenshots or if I update the support url field when it will be reflects to itunes ? Or it will directly reflects once I update my current application ? Thanks in advance...

    Read the article

  • iphone - compiler conditional on header

    - by Mike
    I have a project that generates applications for two targets. One of the targets has to include one additional delegate protocol that should not be present on the other one. So, I have created a macro on Xcode and declared the header like this: #ifdef TARGET_1 @interface myViewController : UIViewController <UIScrollViewDelegate, UIPopoverControllerDelegate> #endif #ifdef TARGET_2 @interface myViewController : UIViewController <UIScrollViewDelegate> #endif { .... bla bla.... } The problem is that Xcode is not liking this "double" declaration of @interface and is giving me all sort of problems. How to solve that? thanks for any help.

    Read the article

  • iPhone apps causing battery to drain out

    - by saurabh
    Hi, Recently my iPhone battery started to discharge in just one day. I do not use my iPhone much (less than 1 hour a day). and then while discussing it with couple of colleagues, I heard that there are some apps which even if installed on your iPhone can cause your battery to drain out faster. It does not matter if you are not using those apps, only having them installed was enough to cause battery drain. I have heard this from couple of my techie friends as well and thus had to put some credibility to it. Being an iPhone developer, I don't think that is possible. Do you think if this is possible for an app to cause battery drain just by being installed there on iPhone?

    Read the article

  • Image 1 becomes image 2 with sliding effect from left to right?

    - by Paul
    I would like to show a second image appearing while a "door" is closing on my character. I've got my character in the middle of the screen and a door coming from the left. When the door passes my character, I would like to have this second image appearing little by little. So far, I've gotten by with fadingOut the character and then fadingIn my second image of the character at the same position when the door is completely closed, but I would like to have both of them at the same time. (the effect that image 1 becomes image 2 when the door is sliding from left to right). Would you know how to do this with Cocos2d? Here are the images : at first, the character is blue, and the door is coming from the left : Then, behind the black door, the character becomes red, but only behind this door, so it stays blue when the door is not on him, and will become completely red when the door passes the character : EDIT : with this code, the black door hides the red and blue rectangles : (And if i add each of my layers at a different depth, and only use GL_LESS, same thing) blue.position = ccp( size.width*0.5 , size.height/2 ); red.position = ccp( size.width*0.46 , size.height/2 ); black.position = ccp( size.width*0.1 , size.height/2 ); glEnable(GL_DEPTH_TEST); [batch addChild:red z:0]; [batch addChild:black z:2]; glDepthFunc(GL_GREATER); [batch addChild:blue z:1]; glDepthFunc(GL_LESS); id action1 = [CCMoveTo actionWithDuration:3 position:ccp(size.width,size.height/2)]; [black runAction: [CCSequence actions:action1, nil]];

    Read the article

  • Adjust sprite bounds of the visible part of texture

    - by Crazy D0G
    Is there any way to adjust the boundaries of the visible part of the sprite? To make it easier to understand: I have a texture, such as shown at figure 1. Then I break it into pieces and fill the resulting fragments using PRKit (wood texture on figure 2 and 3). But the resulting fragments have the transparent (green color on figure 2 and 3) and when creating a sprite from the fragments they have the size of the initial texture. Is there a way to get rid of this transparency and to adjust the size of the visible part (wood texture), openGL or cocos2d-x means? Maybe it help - draw() method from PRKit: void PRFilledPolygon::draw() { //CCNode::draw(); glDisableClientState(GL_COLOR_ARRAY); // we have a pointer to vertex points so enable client state glBindTexture(GL_TEXTURE_2D, texture->getName()); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ONE_MINUS_SRC_ALPHA); glVertexPointer(2, GL_FLOAT, 0, areaTrianglePoints); glTexCoordPointer(2, GL_FLOAT, 0, textureCoordinates); glDrawArrays(GL_TRIANGLES, 0, areaTrianglePointCount); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); //Restore texture matrix and switch back to modelview matrix glEnableClientState(GL_COLOR_ARRAY);}

    Read the article

  • cocos2d MFMailComposeViewController

    - by MRaguse
    hi, i tried to insert a mail tool in my app.... my app is based on the cocos2d engine the Toolbar (at the top -cancel,send...) is visible but i can't see the other parts of the mfMailComposerViewController view :-( code: -(void)displayComposerSheet { MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; [picker setSubject:@"my message"]; // Set up recipients NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"]; NSArray *ccRecipients = [NSArray arrayWithObjects:@"[email protected]", @"[email protected]", nil]; NSArray *bccRecipients = [NSArray arrayWithObject:@"[email protected]"]; [picker setToRecipients:toRecipients]; [picker setCcRecipients:ccRecipients]; [picker setBccRecipients:bccRecipients]; // Attach an image to the email UIImage *screenshot = [[Director sharedDirector] screenShotUIImage]; NSData *myData = UIImagePNGRepresentation(screenshot); [picker addAttachmentData:myData mimeType:@"image/png" fileName:@"AdMotiv"]; // Fill out the email body text NSString *emailBody = @"test"; [picker setMessageBody:emailBody isHTML:NO]; [[picker view] setFrame:CGRectMake(0.0f,0.0f,320.0f, 480.0f)]; [[picker view] setTransform:CGAffineTransformIdentity]; [[picker view] setBounds:CGRectMake(0.0f,0.0f,320.0f, 480.0f)]; //[[[VariableStore sharedInstance] parentView] setTransform: CGAffineTransformIdentity]; //[[[VariableStore sharedInstance] parentView] setBounds : CGRectMake(0.0f, 0.0f, 480.0f, 320.0f)]; UITextField *textfeld = [[UITextField alloc] initWithFrame:CGRectMake(50.0f, 50.0f, 100.0f, 100.0f)]; [[picker view] addSubview:textfeld]; [[[VariableStore sharedInstance] window]addSubview:picker.view]; [[[VariableStore sharedInstance] window] makeKeyAndVisible]; [picker release]; }

    Read the article

  • UItextfield text alignment issue in cocos2D iPhone

    - by shreya
    Hi All, Please take a look of the following screen shot. Here is my code, I am using cocos2D CGAffineTransform transform = CGAffineTransformMakeRotation(3.14159/2); _view = [[CCDirector sharedDirector]openGLView]; // Input the user name _nameField = [[UITextField alloc]initWithFrame:CGRectMake(130.0, 270.0, 200.0, 30.0)]; _nameField.transform = transform; _nameField.adjustsFontSizeToFitWidth = YES; _nameField.textColor = [UIColor blackColor]; [_nameField setFont:[UIFont fontWithName:@"Arial" size:14]]; _nameField.placeholder = @"<Enter Your Name>"; _nameField.backgroundColor = [UIColor clearColor]; _nameField.autocorrectionType = UITextAutocorrectionTypeNo; _nameField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters; _nameField.textAlignment = UITextAlignmentCenter; _nameField.keyboardType = UIKeyboardTypeDefault; _nameField.returnKeyType = UIReturnKeyDone; _nameField.tag = 0; _nameField.delegate = self; _nameField.clearButtonMode = UITextFieldViewModeNever; _nameField.borderStyle = UITextBorderStyleRoundedRect; [_view addSubview:_nameField]; The problem is the text is typing on the top of the text field. I want it to be in the middle not to top.

    Read the article

  • Cocos2D Director Pause/Resume Issue

    - by Aditya
    I am trying to play a .gif animation in cocos2D. For this i am using the library glgif. Now, to display the animation i am pausing the Director, adding a subview to show the animation and after the animation is done i am resuming the Director. However, I am not able to resume the state of the Director and it shows blank. So I tried this without pausing and resuming this Director and it still did not work.I also tried detaching the director before tha animation and adding it back afterwards and even that did not work. So is there a way to pause/suspend the Director in the application and properly restore is back? Thanks. Code sample: [[Director sharedDirector] pause]; [[Director sharedDirector] detach]; AppDelegate *del = [[UIApplication sharedApplication] delegate]; [del.window addSubview:del.viewController.view]; [del.window makeKeyAndVisible]; // this is code to call glgif class and start anim. //code to resume the director AppDelegate *del = [[UIApplication sharedApplication] delegate]; [[Director sharedDirector] resume]; [[Director sharedDirector] attachInView:del.window]; MScene *m = [MScene node]; [[Director sharedDirector] replaceScene:m];

    Read the article

  • Using GKPeerPickerController within a selector from a Cocos2D CCMenuItem

    - by Mark Hazlett
    Hey everyone, So i'm trying to use GameKit along with Cocos2D so that when a user clicks on the multiplayer menu item it will display the GKPeerPickerController. I'm however, running into some snags. It doesn't seem to want to compile. However, it doesn't give me an error inside of the code that's in my selector. Anyways here's the code... @implementation GameOverLayer - (id) init { self = [super init]; if (self != nil) { [CCMenuItemFont setFontSize:20]; [CCMenuItemFont setFontName:@"Helvetica"]; CCMenuItem *start = [CCMenuItemFont itemFromString:@"Play Again!" target:self selector:@selector(startGame:)]; CCMenuItem *connect = [CCMenuItemFont itemFromString:@"Multiplayer" target:self selector:@selector(connect:)]; CCMenu *menu = [CCMenu menuWithItems:start,connect, nil]; [menu alignItemsVertically]; [self addChild:menu]; } return self; } -(void)startGame: (id)sender { [[CCDirector sharedDirector] replaceScene: [HelloWorld scene]]; } -(void)connect: (id)sender { GKPeerPickerController *peerPicker; peerPicker = [[GKPeerPickerController alloc] init]; peerPicker.delegate = self; peerPicker.connectionTypesMask = GKPeerPickerConnectionTypeOnline | GKPeerPickerConnectionTypeNearby; [peerPicker show]; } @end The error message i'm getting is... ".obj_class_name_GKPeerPickerController", referenced from: Literal-Pointer@_OBJC@_cls_refs@GKPeerPickerController in GameOverScene.o Symbol(s) not found Collect2: id returned 1 exit status Any ideas?

    Read the article

  • Test iPhone app on iPad mini?

    - by Devfly
    I have developed an iPhone app, right now I only need a device for testing. I have 300$, and two choices - second hand iPhone 4, or brand new iPad mini. The better choice obviously is the iPad, but is it sufficient for testing iPhone apps on? On the iPad, iPhone apps can run just fine in 2X mode, but are there any differences between the app performance on iPhone and iPad (except the chipset). Should I test my app on actual iPhone, or the iPad will suffice? My app is RSS reader, not some game, so I think everything will be fine with testing on iPad mini. If I buy the iPad I will find some friends iPhone 4/3gs running iOS 5.1 (because my app's deployment target is 5.1, and the iPad comes with 6.0), but of course I can't extensively test on this iPhone. Thank you!

    Read the article

  • GUI device for throwing a ball

    - by Fredrik Johansson
    The hero has a ball, which shall be thrown with accuracy in a court on iPhone/iPad. The player is seen from above, in a 2D view. In game play, the player reach is between 1/15 and 1/6 of the height of the iPhone screen. The player will run, and try to outmaneuver his opponent, and then throw the ball at a specific location, which is guarded by the opponent (which is also shown on the screen). The player is controlled by a joystick, and that works ok, but how shall I control the stick? Maybe someone can propose a third control method? I've tried the following two approaches: Joystick: Hero has a reach of 1 meter, and this reach is marked with a semi-opaque circle around the player. The ball can be moved by a joystick. When the joystick is moved south, the ball is moved south within the reach circle. There is a direct coupling with the joystick and the position of the ball. I.e. when the joystick is moved max south, the ball is max south within the player reach. At each touch update the speed is calculated, and the Box2d ball position and ball speed are updated. NB, the ball will never be moved outside the reach as long as the player push the joystick. The ball is thrown by swiping the joystick to make the ball move, and then releasing the joystick. At release, the ball will get a smoothed speed of the joystick. Joystick Problem: The throwing accuracy gets bad, because the joystick can not be that big, and a small movement results in quite a large movement of the ball. If the user does not release before the end of the joystick maximum end point, the ball will stop, and when the user releases the joystick the speed of the ball will be zero. Bad... Touch pad A force is applied to the ball by a sweep on a touchpad. The ball is released when the sweep is ended, or when the ball is moved outside the player reach. As there is no one to one mapping between the swipe and the ball position, the precision can be improved. A large swipe can result in a small ball movement. Touch Pad Problem A touchpad is less intuitive. Users do not seem to know what to do with the touch pad. Some tap the touchpad, and then the ball just falls to the ground. As there is no one-to-one mapping, the ball can be moved outside the reach, and then it will just fall to the ground. It's a bit hard to control the ball, especially if the player also moves.

    Read the article

  • iphone cocos2d sprites disappearing

    - by jer
    I've been working on a game and implementing the physics stuff with chipmunk. All was going fine on the cocos2d part until the integration with chipmunk. A bit of background: The game is a game with blocks. Levels are defined in a property list, where positions, size of the blocks, gravitational forces, etc., are all defined for each block to be shown in the level. The problem is with the blocks showing up. I have a method on my BlockLayer class which is part of my game's main scene. Upon creation of the layer, the property list is read, and all the blocks are created. The following method is called to create the blocks: - (void)createBlock:(Block*)block withAssets:(NSBundle*)assets { Sprite* sprite; switch(block.blockColour) { case kBlockColourGreen: sprite = [Sprite spriteWithFile:[assets pathForResource:@"green" ofType:@"png" inDirectory:@"Blocks"]]; break; case kBlockColourOrange: sprite = [Sprite spriteWithFile:[assets pathForResource:@"orange" ofType:@"png" inDirectory:@"Blocks"]]; break; case kBlockColourRed: sprite = [Sprite spriteWithFile:[assets pathForResource:@"red" ofType:@"png" inDirectory:@"Blocks"]]; break; case kBlockColourBlue: sprite = [Sprite spriteWithFile:[assets pathForResource:@"blue" ofType:@"png" inDirectory:@"Blocks"]]; break; } sprite.position = block.bounds.origin; [self addChild:sprite]; if(block.blockColour == kBlockColourGreen || block.blockColour == kBlockColourRed) space-gravity = cpvmult(cpv(0, 10), 1000); cpVect verts[] = { cpv(-block.bounds.size.width, -block.bounds.size.height), cpv(-block.bounds.size.width, block.bounds.size.height), cpv(block.bounds.size.width, block.bounds.size.height), cpv(block.bounds.size.width, -block.bounds.size.height) }; cpBody* blockBody = cpBodyNew([block.mass floatValue], INFINITY); blockBody-p = cpv(block.bounds.origin.x, block.bounds.origin.y); blockBody-v = cpvzero; cpSpaceAddBody(space, blockBody); cpShape* blockShape = cpPolyShapeNew(blockBody, 4, verts, cpvzero); blockShape-e = 0.9f; blockShape-u = 0.9f; blockShape-data = sprite; cpSpaceAddShape(space, blockShape); } With the above code, the sprites never show up. However, if I comment out the "cpSpaceAddBody(space, blockBody);" line, the sprites show up. The position and size of the blocks are stored in the "bounds" property of instances of the Block class, which is a CGRect. Not sure if it's important, but the orientation of the app is in landscape left, and all the coordinates are based on that orientation. Any help would be greatly appreciated.

    Read the article

  • iPhone to iPhone wifi ad hoc connexion

    - by ideotop
    Is there a way to create an ad-hoc connexion between 2 iPhone ? Here is the target : iPhone n°1 is serving webpages through an http server (lighttpd) iPhone n°2 connect to iPhone n°1 to see webpages without going through a desktop computer

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >