Search Results

Search found 19072 results on 763 pages for 'iphone sdk 4'.

Page 109/763 | < Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >

  • How to create array with unique sprites? in cocos2d iphone

    - by prakash s
    I write the code like this. This displays only one sprite (red colour bubble) with number of times and moving down, but actually I want to display different sprites (different colour bubble) every time and moving down. I also add no of .png images in resource folder of my project. Here I used only 3.png, but I need to display all *.png images (different colour bubbles) in my project but I don't know how to get this. Please help me Thank you. Here is the code: -(void)addTarget { CCSprite *target = [CCSprite spriteWithFile:@"3.png" rect:CGRectMake(0, 0, 256, 256)]; CGSize winSize = [[CCDirector sharedDirector] winSize]; int minY = target.contentSize.height/2; int maxY = winSize.height - target.contentSize.height/2; int rangeY = maxY - minY; int actualY = (arc4random() % rangeY) + minY; // Create the target slightly off-screen along the right edge, // and along a random position along the Y axis as calculated above target.position = ccp(winSize.width + (target.contentSize.width/2), actualY); [self addChild:target]; // Determine speed of the target int minDuration = 4.0; int maxDuration = 12.0; int rangeDuration = maxDuration - minDuration; int actualDuration = (arc4random() % rangeDuration) + minDuration; // Create the actions id actionMove = [CCMoveTo actionWithDuration:actualDuration position:ccp(-target.contentSize.width/2,actualY)]; id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)]; [target runAction:[CCSequence actions:actionMove, actionMoveDone, nil]]; // Add to targets array target.tag = 2; [_targets addObject:target]; } -(void)gameLogic:(ccTime)dt { [self addTarget]; } -(id) init { if( (self=[super initWithColor:ccc4(255,255,255,255)] )) { // Enable touch events self.isTouchEnabled = YES; // Initialize arrays _targets = [[NSMutableArray alloc] init]; _projectiles = [[NSMutableArray alloc] init]; // Get the dimensions of the window for calculation purposes CGSize winSize = [[CCDirector sharedDirector] winSize]; [self schedule:@selector(gameLogic:) interval:1.0]; [self schedule:@selector(update:)]; } return self; } - (void)update:(ccTime)dt { NSMutableArray *projectilesToDelete = [[NSMutableArray alloc] init]; for (CCSprite *projectile in _projectiles) { CGRect projectileRect = CGRectMake(projectile.position.x - (projectile.contentSize.width/2), projectile.position.y - (projectile.contentSize.height/2), projectile.contentSize.width, projectile.contentSize.height); NSMutableArray *targetsToDelete = [[NSMutableArray alloc] init]; for (CCSprite *target in _targets) { CGRect targetRect = CGRectMake(target.position.x - (target.contentSize.width/2), target.position.y - (target.contentSize.height/2), target.contentSize.width, target.contentSize.height); if (CGRectIntersectsRect(projectileRect, targetRect)) { [targetsToDelete addObject:target]; } } for (CCSprite *target in targetsToDelete) { [_targets removeObject:target]; [self removeChild:target cleanup:YES]; _projectilesDestroyed++; if (_projectilesDestroyed > 30) { //GameOverScene *gameOverScene = [GameOverScene node]; // [gameOverScene.layer.label setString:@"You Win!"]; // [[CCDirector sharedDirector] replaceScene:gameOverScene]; } } if (targetsToDelete.count > 0) { [projectilesToDelete addObject:projectile]; } [targetsToDelete release]; } for (CCSprite *projectile in projectilesToDelete) { [_projectiles removeObject:projectile]; [self removeChild:projectile cleanup:YES]; } [projectilesToDelete release]; }

    Read the article

  • loading 60 images locally fast is it possible...? [closed]

    - by Tariq- iPHONE Programmer
    when my app starts it loads 60 images at a time in UIImageView and it also loads a background music. in simulator it works fine but in IPAD it crashes.. -(void)viewDidLoad { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; //img.animationImages = [[NSArray arrayWithObjects: MyImages = [NSArray arrayWithObjects: //[UIImage imageNamed: @"BookOpeningB001.jpg"],...... B099,nil]; //[NSTimer scheduledTimerWithTimeInterval: 8.0 target:self selector:@selector(onTimer) userInfo:nil repeats:NO]; img.animationImages = MyImages; img.animationDuration = 8.0; // seconds img.animationRepeatCount = 1; // 0 = loops forever [img startAnimating]; [self.view addSubview:img]; [img release]; [pool release]; //[img performSelector:@selector(displayImage:) ]; //[self performSelector:@selector(displayImage:) withObject:nil afterDelay:10.0]; [self performSelector: @selector(displayImage) withObject: nil afterDelay: 8.0]; } -(void)displayImage { SelectOption *NextView = [[SelectOption alloc] initWithNibName:nil bundle:nil]; [self presentModalViewController:NextView animated:NO]; [NextView release]; } Am i doing anything wrong ? Is there any other alternative to load the local images faster in UIImageView !

    Read the article

  • How to check battery usage of an iPhone/Android app?

    - by Gajoo
    I think the title says Enough. For example Unity can generate you a report how much CPU/GPU power it's using or how fast it's going to drain device battery, but what about the applications developed using Cocos2d or the ones you develop directly using OpenGL? How should you profile them? In general what should you profile? or Should I simply run the application and wait for it's battery to run out?

    Read the article

  • iPhone App that only shows a webpage. Allowed in App Store? [closed]

    - by aioobe
    I'm building a mobile web-app. One of the requirements from my client is that the user should be able to install (through App Store) a program that displays the webpage. I'm thinking of either just displaying a UIWebView with the web-page or opening the webpage in the browser. This would be my first experience with App Store, so I'd like to ask: Would I run into any troubles regarding acceptance in App Store for such "just-show-whatever-the-server-gives-me" application?

    Read the article

  • Selecting text in mobile Safari on iPhone

    - by Goldy
    I'm trying to make it easy for an iphone user to copy some text to the clipboard in mobile safari. As in the usual "touch-hold-copy". There is a specific bit of text I want to a user to copy. I have full choice of the html markup in which to wrap the text. How can I make it easy, rather than abitrary? For instance: Is there a way to "select all" the text upon touch-down using javascript? Then a user could just continue to touch-hold and then choose copy? Is there a way to bring up the "select all" option? Like you can when typing in a text box? After which they can choose copy? If there's no javascript solution, how can I arrange the html to help Safari select the right bit of text easily? As opposed to just a word, or a wrapping div? I've tried onFocus="this.select()" for various elements, none seem to work. Also tried onClick. Those who have tried to port a site that uses ZeroClipboard to the iPhone might have some ideas. Cheers

    Read the article

  • How to change the border color of a Grouped UITableView

    - by ctpenrose
    This concerns iPhoneOS-sdk-3.2 I am having difficulty changing the border color of a grouped UITableView. I can change the cell background color, separator color, text color, quite easily now, and the rounded corners clip correctly, even when highlighted with whatever colors I have chosen. However the surrounding border remains infuriatingly gray despite many different attempts. I have read all of the related posts I can find via Google, let alone stackoverflow. I have tried both a programmatic and xib-based solution and both provide the same results. I will share the programmatic version below: I have a UIViewController subclass rather than a UITableViewController subclass to act as a UITableView delegate -- I chose this route as I am coding on the iPad and UITableViewController reportedly takes over the whole screen. loadView method of my UIViewController subclass: - (void) loadView { self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; [self.view release]; self.view.backgroundColor = [UIColor blackColor]; // add and configure UITableView CGRect tableViewRect = CGRectMake(0., 0., 256., 768.); myTableView = [[UITableView alloc] initWithFrame:tableViewRect style:UITableViewStyleGrouped]; // set the tableview delegate to this object and the datasource to the datasource which has already been set myTableView.delegate = self; myTableView.dataSource = self; myTableView.sectionIndexMinimumDisplayRowCount=1; myTableView.backgroundColor = [UIColor clearColor]; myTableView.separatorColor = [UIColor whiteColor]; myTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; myTableView.opaque = NO; // add the table view to our background view [self.view addSubview:myTableView]; [myTableView release]; }

    Read the article

  • iPod/iPhone OpenGL ES UIView flashes when updating

    - by Dave Viner
    I have a simple iPhone application which uses OpenGL ES (v1) to draw a line based on the touches of the user. In the XCode Simulator, the code works perfectly. However, when I install the app onto an iPod or iPhone, the OpenGL ES view "flashes" when drawing the line. If I disable the line drawing, the flash disappears. By "flash", I mean that the background image (which is an OpenGL texture) disappears momentarily, and then reappears. It appears as if the entire scene is completely erased and redrawn. The code which handles the line drawing is the following: renderLineFromPoint:(CGPoint)start toPoint:(CGPoint)end { static GLfloat* vertexBuffer = NULL; static NSUInteger vertexMax = 64; NSUInteger vertexCount = 0, count, i; //Allocate vertex array buffer if(vertexBuffer == NULL) vertexBuffer = malloc(vertexMax * 2 * sizeof(GLfloat)); //Add points to the buffer so there are drawing points every X pixels count = MAX(ceilf(sqrtf((end.x - start.x) * (end.x - start.x) + (end.y - start.y) * (end.y - start.y)) / kBrushPixelStep), 1); for(i = 0; i < count; ++i) { if(vertexCount == vertexMax) { vertexMax = 2 * vertexMax; vertexBuffer = realloc(vertexBuffer, vertexMax * 2 * sizeof(GLfloat)); } vertexBuffer[2 * vertexCount + 0] = start.x + (end.x - start.x) * ((GLfloat)i / (GLfloat)count); vertexBuffer[2 * vertexCount + 1] = start.y + (end.y - start.y) * ((GLfloat)i / (GLfloat)count); vertexCount += 1; } //Render the vertex array glVertexPointer(2, GL_FLOAT, 0, vertexBuffer); glDrawArrays(GL_POINTS, 0, vertexCount); //Display the buffer [context presentRenderbuffer:GL_RENDERBUFFER_OES]; } (This function is based on the function of the same name from the GLPaint sample application.) For the life of me, I can not figure out why this causes the screen to flash. The line is drawn properly (both in the Simulator and in the iPod). But, the flash makes it unusable. Anyone have ideas on how to prevent the "flash"?

    Read the article

  • iPhone/iPod receive messages from C# tcpip server using CocoaAsyncSocket

    - by SorinA.
    Hello, i'm trying to send/receive data over wifi to an iphone/ipodtouch app from a C# tcpip server. for this i used cocoaAsyncSocket from the google project. If i push a button and i send a request from ipod to server it returns the requested data(song title for example)..i want to know every second what song is playng...so from C# server i send at intervals of 1 second messages to my app. In my app in an timer with the interval of 1 second i call the asyncSocket read readDataWithTimeout method. My problem is that after 8-9 seconds that method is not called anymore. The connection to the server is still active and the C# server still sends data.. what i want to do is the following thing: - winamp plays a song - C# server asks winamp what songs is he playing and sends the song title to my app. - iphone app receives the data and displays it i don't know why the readDataWithTimeout method is not called anymore after a short period of time..Maybe because the short time between messages sent by the C# server? Thank you, Sorin

    Read the article

  • IPhone accelerometer works even in flat surface.

    - by Amaresh
    I have an imageView in the view. It moves even if the iphone is still for some time. Why is it so ? Also the image does not respond quickly to the movement of the iphone. Here is my code written for this: I have also set the updateInterval and delegate for the accelerometer. #define kVelocityMultiplier 1000; -(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { if(currentPoint.x < 0) { currentPoint.x=0; ballXVelocity=0; } if(currentPoint.x > 480-sliderWidth) { currentPoint.x=480-sliderWidth; ballXVelocity=0; } static NSDate *lastDrawTime; if(currentPoint.x<=480-sliderWidth&&currentPoint.x>=0) { if(lastDrawTime!=nil) { NSTimeInterval secondsSinceLastDraw=-([lastDrawTime timeIntervalSinceNow]); ballXVelocity = ballXVelocity + -acceleration.y*secondsSinceLastDraw; CGFloat xAcceleration=secondsSinceLastDraw * ballXVelocity * kVelocityMultiplier; currentPoint = CGPointMake(currentPoint.x + xAcceleration, 266); } slider.frame=CGRectMake(currentPoint.x, currentPoint.y, sliderWidth, 10); } [lastDrawTime release]; lastDrawTime=[[NSDate alloc]init]; } Can anyone help me out please ?

    Read the article

  • UIView using Quartz rendering engine to display PDF has poor quality compared to original.

    - by Josh Kerr
    I'm using the quartz rendering engine to display a PDF file on the iphone using the 3.0 SDK. The result is a bit blurry compared to a PDF being shown in a UIWebView. How can I improve the quality in the UIView so that I don't need to rewrite my app to use the UIWebView. I'm using pretty much close to the example code that Apple provides. Here is some of my sample code: CGContextRef gc = UIGraphicsGetCurrentContext(); CGContextSaveGState(gc); CGContextTranslateCTM(gc, 0.0, rect.size.height); CGContextScaleCTM(gc, 1.0, -1.0); CGAffineTransform m = CGPDFPageGetDrawingTransform(page, kCGPDFCropBox, rect, 0, false); CGContextConcatCTM(gc, m); CGContextSetGrayFillColor(gc, 1.0, 1.0); CGContextFillRect(gc, rect); CGContextDrawPDFPage(gc, page); CGContextRestoreGState(gc); Apple's tutorial code actually results in a blurry PDF view as well. If you drop the same PDF into a UIWebView you'll see it is actually sharper. Anyone have any ideas? This one issue is holding a two year development project from launching. :(

    Read the article

  • iPhone Keychain Questions

    - by AO
    Some questions: * Is there some way to view the data present in the iPhone keychain? * The items an application adds, cannot be accessed by any other application, can it? * What is the purpose of the identifier and access group in the initialization? My guess is that the identifier is simply used to find items but I'm a little bit unsure of the access group. If the access group is assigned nil, all applications can access the items? If the access group is assigned X, could the items be accessed by another application with the same string X as access group or what is the purpose of the access group in this case? * Is the data in the keychain removed when the application is removed? If not, how do I achieve that? And finally: I can't get the KeychainItemWrapper (Apple example) to work. I've added the KeychainItemWrapper files to my project and when running it on the phone, an exception is thrown by SecItemAdd, saying that one or more parameters were not valid (result code -50). The code triggering the SecItemAdd follows: KeychainItemWrapper* wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"something" accessGroup:@"com.company.whatever"]; [wrapper setObject:@"this is my password" forKey:@"password"]; NSLog(@"Password: %@", [wrapper objectForKey:@"password"]); The code can be found at http://developer.apple.com/iphone/library/samplecode/GenericKeychain/index.html

    Read the article

  • monitoring iphone 3g/wifi bandswitch

    - by user262325
    Hello everyone I hope add the function to monitor iphone used 3g/wifi band switch. I know I can do these in my app, but I wonder if there is way to monitor all band switch usage of iPhone? I noticed that there is an app http://itunes.apple.com/ca/app/download-meter-for-wi-fi-gprs/id327227530?mt=8 It claims: Works with any carrier (iPods are supported too!). Requires no login/password to your carrier's site. Does not require Internet connection to get traffic usage statistics (works even in Airplane mode) because it gets information on traffic from the device, not a carrier; this means it won't cost you anything to view current traffic consumed, even while roaming in a location where traffic is very expensive. Allows the user to adjust consumed traffic for today or the current month to match traffic amounts reported by your carrier. Stats on the screen are updated every second. Measures traffic in real time with up to byte precision. Separates traffic into incoming and outgoing, Wi-Fi traffic and mobile Internet traffic. It looks like it gets the band switch info from carrier site, but they also said it gets info from device. I am really confused. Welcome any comment. Thanks interdev

    Read the article

  • Google appengine authentication on iPhone web app on the home screen

    - by Rakesh Pai
    I'm using Google appengine for developing an web application that is meant to be used on both the browser and iphone. I have purchased a domain name for this application, so that I have a pretty URL. I've used the User API for authentication. This works just fine on desktop browsers and iPhone Safari. The user could add the application to the home screen (by tapping the "+" at the bottom toolbar). However when that's done, it seems like the cookies set by Google are not in affect within this "application", and the user is effectively logged out. To make matters worse, when the user clicks on the login link (as generated by GAE), the app closes and opens safari to complete the login. Since the session is apparently not shared between the two, the login process is futile, and the "home-screen" version of the app continues to be logged out. It seems that the cookies are not shared between a "home-screen" app and Safari. It also seems that the "home-screen" app will only work within it's own domain, and any redirect to any other domain will open Safari. Any idea how I can go about fixing this?

    Read the article

  • CGContextSetShadow() - shadow direction reversed between iOS 3.0 and 4.0?

    - by Pascal
    I've been using CGContextSetShadowWithColor() in my Quartz drawing code on the iPhone to generate the "stomped in" look for text and other things (in drawRect: and drawLayer:inContext:). Worked perfectly, but when running the exact same code against iOS 3.2 and now iOS 4.0 I noticed that the shadows are all in the opposite direction. E.g. in the following code I set a black shadow to be 1 pixel above the text, which gave it a "pressed in" look, and now this shadow is 1px below the text, giving it a standard shadow. ... CGContextSetShadowWithColor(context, CGSizeMake(0.f, 1.f), 0.5f, shadowColor); CGContextShowGlyphsAtPoint(context, origin.x, origin.y, glyphs, length); ... Now I don't know whether I am (or have been) doing something wrong or whether there has been a change to the handling of this setting. I haven't applied any transformation that would explain this to me, at least not knowingly. I've flipped the text matrix in one instance, but not in others and this behavior is consistent. Plus I wasn't able to find anything about this in the SDK Release Notes, so it looks like it's probably me. What might be the issue?

    Read the article

  • Tab bar controller inside a navigation controller, or sharing a navigation root view

    - by Daniel Dickison
    I'm trying to implement a UI structured like in the Tweetie app, which behaves as so: the top-level view controller seems to be a navigation controller, whose root view is an "Accounts" table view. If you click on any account, it goes to the second level, which has a tab bar across the bottom. Each tab item shows a different list and lets you drill down further (the subsequent levels don't show the tab bar). So, this seems like the implementation hierarchy is: UINavigationController Accounts: UITableViewController UITabBarController Tweets: UITableViewController Detail view of a tweet/user/etc Replies: UITableViewController ... This seems to work[^1], but appears to be unsupported according to the SDK documentation for -pushViewController:animated: (emphasis added): viewController: The view controller that is pushed onto the stack. It cannot be an instance of tab bar controller. I would like to avoid private APIs and the like, but I'm not sure why this usage is explicitly prohibited even when it seems to work fine. Anyone know the reason? I've thought about putting the tab bar controller as the main controller, with each of the tabs containing separate navigation controllers. The problem with this is that each nav controller needs to share a single root view controller (namely the "Accounts" table in Tweetie) -- this doesn't seem to work: pushing the table controller to a second nav controller seems to remove it from the first. Not to mention all the book-keeping when selecting a different account would probably be a pain. How should I implement this the Right Way? [^1]: The tab bar controller needs to be subclassed so that the tab bar controller's navigation item at that level stays in sync with the selected tab's navigation item, and the individual tab's table controller's need to push their respective detail views to self.tabBarController.navigationController instead of self.navigationController.

    Read the article

  • How to make a UITextField move up when keyboard is present

    - by philfreo
    EDIT: Over 1k views with 3 upvotes? If this question is helpful, vote it up :) With the iPhone SDK: I have a UIView with UITextFields that brings up a keyboard. I need it to be able to: Allow scrolling of the contents of the UIScrollView to see the other text fields once the keyboard is brought up Automatically "jump" (by scrolling up) or shortening I know that I need a UIScrollView. I've tried changing the class of my UIView to a UIScrollView but I'm still unable to scroll the textboxes up or down. Do I need both a UIView and a UIScrollView? Does one go inside the other? [EDIT: I now know that you want a UIView inside of a UIScrollView, and the trick is to programatically set the content size of the UIScrollView to the frame size of the UIView.] Then what needs to be implemented in order to automatically scroll to the active text field? Ideally as much of the setup of the components as possible will be done in Interface Builder. I'd like to only write code for what needs it. Note: the UIView (or UIScrollView) that I'm working with is brought up by a tabbar (UITabBar), which needs to function as normal. Edit: I am adding the scroll bar just for when the keyboard comes up. Even though it's not needed, I feel like it provides a better interface because then the user can scroll and change textboxes, for example. I've got it working where I change the frame size of the UIScrollView when the keyboard goes up and down. I'm simply using: -(void)textFieldDidBeginEditing:(UITextField *)textField { //Keyboard becomes visible scrollView.frame = CGRectMake(scrollView.frame.origin.x, scrollView.frame.origin.y, scrollView.frame.size.width, scrollView.frame.size.height - 215 + 50); //resize } -(void)textFieldDidEndEditing:(UITextField *)textField { //keyboard will hide scrollView.frame = CGRectMake(scrollView.frame.origin.x, scrollView.frame.origin.y, scrollView.frame.size.width, scrollView.frame.size.height + 215 - 50); //resize } However this doesn't automatically "move up" or center the lower text fields in the visible area, which is what I would really like.

    Read the article

  • Having problems with uploading photos to TwitPic using OAuth in Objective C on the iPhone

    - by M. Bedi
    I have been working on an iPhone app that has a feature of uploading photos to TwitPic. I have it working with basic authentication. I am trying to get it working with OAuth. I am getting authentication errors. I have studied very carefully the TwitPic documentation. I am authorising the app by displaying a UI Web View and the it returns a PIN value. I enter the PIN value in the app and request the token. I am able to upload status updates to Twitter but not photos. My code is based on some example code from here: Example iPhone app using OAuth Here is my code: NSString *url = @"http://api.twitpic.com/2/upload.json"; NSString *oauth_header = [oAuth oAuthHeaderForMethod:@"POST" andUrl:url andParams:nil]; NSLog(@"OAuth header : %@\n\n", oauth_header); ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]]; [request addRequestHeader:@"User-Agent" value:@"ASIHTTPRequest"]; request.requestMethod = @"POST"; [request addRequestHeader:@"X-Auth-Service-Provider" value:@"https://api.twitter.com/1/account/verify_credentials.json"]; [request addRequestHeader:@"X-Verify-Credentials-Authorization" value:oauth_header]; NSData *imageRepresentation = UIImageJPEGRepresentation(imageToUpload, 0.8); [request setData:imageRepresentation forKey:@"media"]; [request setPostValue:@"Some Message" forKey:@"message"]; [request setPostValue:TWITPIC_API_KEY forKey:@"key"]; [request setDelegate:self]; [request setDidFinishSelector:@selector(requestDone:)]; [request setDidFailSelector:@selector(requestFailed:)]; [request start]; Here is the OAuth Header: OAuth realm="http://api.twitter.com/", oauth_timestamp="1275492425", oauth_nonce="b686f20a18ba6763ac52b689b2ac0c421a9e4013", oauth_signature_method="HMAC-SHA1", oauth_consumer_key="zNbW3Xi3MuS7i9cpz6fw", oauth_version="1.0", oauth_token="147275699-jmrjpwk3B6mO2FX2BCc9Ci9CRBbBKYW1bOni2MYs", oauth_signature="d17HImz6VgygZgbcp845CD2qNnI%3D"

    Read the article

  • Geolocation Firefox accurate than iPhone Safari?

    - by johnz
    I just tested Geolocation on Firefox 3.6 and iPhone Safari (os 3.1.3), the result is interesting, firefox is more accurate than safari. any one got idea how to make iPhone Safari result more accurate. this is the code for testing: navigator.geolocation.getCurrentPosition(handler, {enableHighAccuracy: true}); function handler(location) { var message = document.getElementById("message"); message.innerHTML = "<img src='http://maps.google.com/staticmap?sensor=true&center=" + location.coords.latitude + "," + location.coords.longitude + "&size=300x300&maptype=street&zoom=16&key=ABQIAAAAZrVtlT2df2pkfI_RZB_6WBRWTAkRKJS7h1XjKaOTqACHuw1n0BT5cATkkKFnZNGHmrwUw9IilQK0Eg' />"; message.innerHTML+="<p>Longitude: " + location.coords.longitude + "</p>"; message.innerHTML+="<p>Latitude: " + location.coords.latitude + "</p>"; message.innerHTML += "<p>Accuracy: " + location.coords.accuracy + "</p>"; // call the function with my current lat/lon getPlaceFromFlickr(location.coords.latitude, location.coords.longitude, 'output'); } . . test from here

    Read the article

  • Custom Keyboard (iPhone), UIKeyboardDidShowNotification and UITableViewController

    - by Pascal
    On an iPhone App, I've got a custom keyboard which works like the standard keyboard; it appears if a custom textfield becomes first responder and hides if the field resigns first responder. I'm also posting the Generic UIKeyboardWillShowNotification, UIKeyboardDidShowNotification and their hiding counterparts, like follows: NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithCapacity:5]; [userInfo setObject:[NSValue valueWithCGPoint:self.center] forKey:UIKeyboardCenterBeginUserInfoKey]; [userInfo setObject:[NSValue valueWithCGPoint:shownCenter] forKey:UIKeyboardCenterEndUserInfoKey]; [userInfo setObject:[NSValue valueWithCGRect:self.bounds] forKey:UIKeyboardBoundsUserInfoKey]; [userInfo setObject:[NSNumber numberWithInt:UIViewAnimationCurveEaseOut] forKey:UIKeyboardAnimationCurveUserInfoKey]; [userInfo setObject:[NSNumber numberWithDouble:thisAnimDuration] forKey:UIKeyboardAnimationDurationUserInfoKey]; [[NSNotificationCenter defaultCenter] postNotificationName:UIKeyboardWillShowNotification object:nil userInfo:userInfo]; This code is working and I use it in UIViewController subclasses. Now since iPhone OS 3.0, UITableViewController automatically resizes its tableView when the system keyboards show and hide. I'm only now compiling against 3.0 and I thought that the controller should also resize the table if my custom keyboard appears, since I'm posting the same notification. However it doesn't. The table view controller is set as the delegate of the input fields. Does anyone have an idea why this might be the case? Has anyone implemented something similar successfully? I have standard input fields along the custom ones, so if the user changes the fields the standard keyboard hides and the custom one shows. It would be beneficial if the tableView didn't resize to full height and I didn't have to resize it back with a custom method.

    Read the article

  • iPhone openGLES performance tuning

    - by genesys
    Hey there! I'm trying now for quite a while to optimize the framerate of my game without really making progress. I'm running on the newest iPhone SDK and have a iPhone 3G 3.1.2 device. I invoke arround 150 drawcalls, rendering about 1900 Triangles in total (all objects are textured using two texturelayers and multitexturing. most textures come from the same textureAtlasTexture stored in pvrtc 2bpp compressed texture). This renders on my phone at arround 30 fps, which appears to me to be way too low for only 1900 triangles. I tried many things to optimize the performance, including batching together the objects, transforming the vertices on the CPU and rendering them in a single drawcall. this yelds 8 drawcalls (as oposed to 150 drawcalls), but performance is about the same (fps drop to arround 26fps) I'm using 32byte vertices stored in an interleaved array (12bytes position, 12bytes normals, 8bytes uv). I'm rendering triangleLists and the vertices are ordered in TriStrip order. I did some profiling but I don't really know how to interprete it. instruments-sampling using Instruments and Sampling yelds this result: http://neo.cycovery.com/instruments_sampling.gif telling me that a lot of time is spent in "mach_msg_trap". I googled for it and it seems this function is called in order to wait for some other things. But wait for what?? instruments-openGL instruments with the openGL module yelds this result: http://neo.cycovery.com/intstruments_openglES_debug.gif but here i have really no idea what those numbers are telling me shark profiling: profiling with shark didn't tell me much either: http://neo.cycovery.com/shark_profile_release.gif the largest number is 10%, spent by DrawTriangles - and the whole rest is spent in very small percentage functions Can anyone tell me what else I could do in order to figure out the bottleneck and could help me to interprete those profiling information? Thanks a lot!

    Read the article

  • iPhone app doesn't build crash reports

    - by BankStrong
    My app formerly created useful crash logs. I synced my iPhone in the past and found crash logs in library/logs/CrashReporter About a month ago, my app stopped creating crash reports. When I first discovered this problem, I assumed it was due to memory corruption (a possibility in my app). I just created a new project and added a crash to it. // Implement viewDidLoad to do additional setup after loading the view, // typically from a nib. - (void)viewDidLoad { NSMutableArray *array = [[NSMutableArray alloc] init]; [array removeObjectAtIndex:-1]; [super viewDidLoad]; } This app does not create a crash report either. Ideas I've started to explore: My phone is corrupted (tried restoring - somehow I brought it to the state from a few months ago) My XCode is corrupt (tried reinstalling, but current download demands Snow Leopard - and I can't upgrade to Snow Leopard online). This seems possible - I may have messed with device support around a month ago (similar to http://stackoverflow.com/questions/1224867/does-iphone-os-3-0-1-ruin-your-development-phone ) The location for crash logs has somehow moved. Suggestions?

    Read the article

  • ocunit testing on iPhone

    - by Magnus Poromaa
    Hi I am trying to get ocunit working in my project from XCode. Since I also need to debug in the unit tests I am using a script that automates the setup (see below). I just include it in the project under resources and change the name to the .ocunit file I want it to run. The problem I get is that it cant find the bundle file and therefore exists with an error. Can anyone who has a clue about XCode and objective-c take a look at it and tell me what is wrong. Also how am I supposed to produce the .ocunit file that I need to run. By setting up a new unit test target for the iPhone and add tests to it or? Hope someone has a clue since I just started ny iPhone development and need to get it up and running quickly Apple Script -- The only customized value we need is the name of the test bundle tell me to activate tell application "Xcode" activate set thisProject to project of active project document tell thisProject set testBundleName to name of active target set unitTestExecutable to make new executable at end of executables set name of unitTestExecutable to testBundleName set path of unitTestExecutable to "/Applications/TextEdit.app" tell unitTestExecutable -- Add a "-SenTest All" argument make new launch argument with properties {active:true, name:"-SenTest All"} -- Add the magic set injectValue to "$(BUILT_PRODUCTS_DIR)/" & testBundleName & ".octest" make new environment variable with properties {active:true, name:"XCInjectBundle", value:injectValue} make new environment variable with properties {active:true, name:"XCInjectBundleInto", value:"/Applications/TextEdit.app/Contents/MacOS/TextEdit"} make new environment variable with properties {active:true, name:"DYLD_INSERT_LIBRARIES", value:"$(DEVELOPER_LIBRARY_DIR)/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection"} make new environment variable with properties {active:true, name:"DYLD_FALLBACK_FRAMEWORK_PATH", value:"$(DEVELOPER_LIBRARY_DIR)/Frameworks"} end tell end tell end tell Cheers Magnus

    Read the article

  • Change UIButton Background Image more than once per second

    - by beta.services
    I am currently working with the iPhone SDK. I have a NSTimer that changes the background image of a UIButton. Once this is complete, it will trigger the same action again (reset the NSTimer) for a predetermined number of times. My problem is that if my NSTimer is set to execute more than once per second. (0.75, say) The background image wont change. I am using NSLog to check that the event fires. But the button image will just remain in its original state. Is there any way to change the background image more often than once per second? This is my timer : [NSTimer scheduledTimerWithTimeInterval: tmpLvlSpeed target: self selector: @selector(simPressRed:) userInfo: nil repeats: NO]; And the code to change the image: [btnRed setImage:[UIImage imageNamed:@"btn_red.png"] forState:UIControlStateNormal]; if tmpLvlSpeed is less than 1.0, the button image will never change. Even though the simPressRed function will still fire. Any clues? Is there an update cycle I can modify?

    Read the article

  • iPhone app stopped building crash reports

    - by BankStrong
    My app formerly created useful crash logs. I synced my iPhone in the past and found crash logs in library/logs/CrashReporter About a month ago, my app stopped creating crash reports. When I first discovered this problem, I assumed it was due to memory corruption (a possibility in my app). I just created a new project and added a crash to it. // Implement viewDidLoad to do additional setup after loading the view, // typically from a nib. - (void)viewDidLoad { NSMutableArray *array = [[NSMutableArray alloc] init]; [array removeObjectAtIndex:-1]; [super viewDidLoad]; } This app does not create a crash report either. Ideas I've started to explore: My phone is corrupted (tried restoring - somehow I brought it to the state from a few months ago) My XCode is corrupt (tried reinstalling, but current download demands Snow Leopard - and I can't upgrade to Snow Leopard online). This seems possible - I may have messed with device support around a month ago (similar to http://stackoverflow.com/questions/1224867/does-iphone-os-3-0-1-ruin-your-development-phone ) The location for crash logs has somehow moved. Suggestions?

    Read the article

  • Displaying indexed png- files out of NSArray on the iphone screen

    - by Thomas Hülsmann
    Hi, i like to create an artwork counter- display on an iphone, diplaying 0 to 9. The 10 digits are 10 png- files with the numbers 0 to 9 as their artwork content. The 10 png- files are implemented by using NSArray. Following you'll find the implementation- code: zahlenArray = [NSArray arrayWithObjects: [UIImage imageNamed:@"ziffer-0.png"], [UIImage imageNamed:@"ziffer-1.png"], [UIImage imageNamed:@"ziffer-2.png"], [UIImage imageNamed:@"ziffer-3.png"], [UIImage imageNamed:@"ziffer-4.png"], [UIImage imageNamed:@"ziffer-5.png"], [UIImage imageNamed:@"ziffer-6.png"], [UIImage imageNamed:@"ziffer-7.png"], [UIImage imageNamed:@"ziffer-8.png"], [UIImage imageNamed:@"ziffer-9.png"], nil]; As an index for the 10 digitis I use an integer variable, initializing with 0: int counter = 0; Furthermore I declare an UIImageview programmaticaly: UIImageView *zahlenEinsBisNeun; The implementation code for the UIImageview is: zahlenEinsBisNeun = [UIImage alloc] initWithFrame:CGRectMake(240, 50, 200, 200)]; ???????????????????????????????????????? [self.view addSubview:zahlenEinsBisNeun]; [zahlenEinsBisNeun release]; There, where you see the questionmarks, I don't know how to write the code, to retrieve my content artworks 0 to 9 from NSArray with the index "counter" and make it visible on my iphone screen by using .... addSubview:zahlenEinsBisNeun ... Can anybody help??? My thanks for your support in advance Thomas Hülsmann

    Read the article

< Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >