Search Results

Search found 15682 results on 628 pages for 'iphone'.

Page 145/628 | < Previous Page | 141 142 143 144 145 146 147 148 149 150 151 152  | Next Page >

  • Toubleshooting mapkit performance

    - by brettr
    I'm plotting over 500 points on a map using mapkit. Zooming is a little jittery compared to the native google map app. I've discovered what is causing the slowness. I'm adding custom annotations so that I can later add different pin colors and buttons for detail views: - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(AddressNote *) annotation { MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentlocation"]; annView.pinColor = MKPinAnnotationColorGreen; annView.animatesDrop=TRUE; annView.canShowCallout = YES; annView.calloutOffset = CGPointMake(-5, 5); return annView; } If I comment out the above code, everything works fine. Very smooth with zooming in/out. Should I be adding annotations differently to boost performance?

    Read the article

  • Where is the leak?

    - by Horatiu Paraschiv
    UIGraphicsBeginImageContext(targetSize); //instruments show here a leak 128bytes CGRect thumbnailRect = CGRectZero; thumbnailRect.origin = thumbnailPoint; thumbnailRect.size.width = scaledWidth; thumbnailRect.size.height = scaledHeight; [sourceImage drawInRect:thumbnailRect]; newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); Hi I'm trying to scale a UIImage so I load it with [UIImage imageNamed:@"myImage.png"]; and then pass it into a method. In that method I have the code above that resizes my image and at the end of the method I have a return newImage; The instruments show me a leak at line UIGraphicsBeginImageContext(targetSize); //instruments show here a leak 128bytes What am I doing wrong? Where exactly is the leak?

    Read the article

  • UIDisplayLink stops updating when UIScrollView scrolled

    - by Tricky
    Title is quite self explanatory, but I have some animation being done in a loop triggered by UIDisplayLink. However, as soon as I scroll a UIScrollView I have added to my view hierarchy, the animation stops immediately, only to return again when scrolling has completely stopped and come to a standstill.... Anyway to cancel this behaviour?

    Read the article

  • iPhone noob - setting NSMutableDictionary entry inside Singleton?

    - by codemonkey
    Yet another iPhone/Objective-C noob question. I'm using a singleton to store app state information. I'm including the singleton in a Utilities class that holds it (and eventually other stuff). This utilities class is in turn included and used from various view controllers, etc. The utilities class is set up like this: // Utilities.h #import <Foundation/Foundation.h> @interface Utilities : NSObject { } + (id)GetAppState; - (id)GetAppDelegate; @end // Utilities.m #import "Utilities.h" #import "CHAPPAppDelegate.h" #import "AppState.h" @implementation Utilities CHAPPAppDelegate* GetAppDelegate() { return (CHAPPAppDelegate *)[UIApplication sharedApplication].delegate; } AppState* GetAppState() { return [GetAppDelegate() appState]; } @end ... and the AppState singleton looks like this: // AppState.h #import <Foundation/Foundation.h> @interface AppState : NSObject { NSMutableDictionary *challenge; NSString *challengeID; } @property (nonatomic, retain) NSMutableDictionary *challenge; @property (nonatomic, retain) NSString *challengeID; + (id)appState; @end // AppState.m #import "AppState.h" static AppState *neoAppState = nil; @implementation AppState @synthesize challengeID; @synthesize challenge; # pragma mark Singleton methods + (id)appState { @synchronized(self) { if (neoAppState == nil) [[self alloc] init]; } return neoAppState; } + (id)allocWithZone:(NSZone *)zone { @synchronized(self) { if (neoAppState == nil) { neoAppState = [super allocWithZone:zone]; return neoAppState; } } return nil; } - (id)copyWithZone:(NSZone *)zone { return self; } - (id)retain { return self; } - (unsigned)retainCount { return UINT_MAX; //denotes an object that cannot be released } - (void)release { // never release } - (id)init { if (self = [super init]) { challengeID = [[NSString alloc] initWithString:@"0"]; challenge = [NSMutableDictionary dictionary]; } return self; } - (void)dealloc { // should never be called, but just here for clarity [super dealloc]; } @end ... then, from a view controller I'm able to set the singleton's "challengeID" property like this: [GetAppState() setValue:@"wassup" forKey:@"challengeID"]; ... but when I try to set one of the "challenge" dictionary entry values like this: [[GetAppState() challenge] setObject:@"wassup" forKey:@"wassup"]; ... it fails giving me an "unrecognized selector sent..." error. I'm probably doing something really obviously dumb? Any insights/suggestions will be appreciated.

    Read the article

  • How can I create a button with a UIActivityIndicator in my navigation bar with the same style as nor

    - by Jarin Udom
    All of the examples I've seen on here and other sites involved creating a UIActivityIndicatorView and loading it with something like: self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:myActivityIndicatorView target:nil action:nil] autorelease]; However, that just creates a plain activity indicator in the navigation bar. What I want to do is have a button that looks just like the normal UIBarButtonSystemItem buttons but with an activity indicator instead of one of the default images. I've tried doing initWithImage and initWithTitle with nil images or titles and then adding the activity indicator as a subview, but that doesn't work. Any ideas?

    Read the article

  • Cocos2D installation?

    - by Tate Allen
    Hello, I am trying to install cocos2D but when I put it into terminal, I get the error: Error: This script must be run as root in order to copy templates to /Library/Application Support/Developer/Shared/Xcode What am I doing wrong here? Thanks in advance, Tate

    Read the article

  • Why I got a "sent to freed object error"?

    - by Tattat
    I have a Table View, and CharTableController, the CharTableController works like this: .h: #import <Foundation/Foundation.h> @interface CharTableController : UITableViewController <UITableViewDelegate, UITableViewDataSource>{ // IBOutlet UILabel *debugLabel; NSArray *listData; } //@property (nonatomic, retain) IBOutlet UILabel *debugLabel; @property (nonatomic, retain) NSArray *listData; @end The .m: #import "CharTableController.h" @implementation CharTableController @synthesize listData; - (void)viewDidLoad { NSArray *array = [[NSArray alloc] initWithObjects:@"Sleepy", @"Sneezy", @"Bashful", @"Happy", @"Doc", @"Grumpy", @"Dopey", @"Thorin", @"Dorin", @"Nori", @"Ori", @"Balin", @"Dwalin", @"Fili", @"Kili", @"Oin", @"Gloin", @"Bifur", @"Bofur", @"Bombur", nil]; self.listData = array; [array release]; [super viewDidLoad]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.listData count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease]; NSUInteger row = [indexPath row]; cell.textLabel.text = [listData objectAtIndex:row]; } return cell; } @end And I Use the IB to link the TableView's dataSource and delegate to the CharTableController. In the CharTableController's view is the TableView in IB obviously. Reference Object in dataSource TableView and delegate TableView. What's wrong with my setting? thz.

    Read the article

  • NSNumberFormatter to display custom labels for 10^n (10000 -> 10k)

    - by Michele Colombo
    I need to display numbers on a plot axis. The values could change but I want to avoid too long numbers that will ruin the readability of the graph. My thought was to group every 3 characters and substitute them with K, M and so on (or a custom character). So: 1 - 1, 999 - 999, 1.000 - 1k, 1.200 - 1.2k, 1.280 - 1.2k, 12.800 - 12.8k, 999.999 - 999.9k, 1.000.000 - 1M, ... Note that probably I'll only need to format round numbers (1, 10, 1000, 1500, 2000, 10000, 20000, 30000, 100000, ...). Is that possibile with NSNumberFormatter? I saw that it has a setFormat method but I don't know how much customizable it is. I'm using NSNumberFormatter cause the graph object I use wants it to set label format and I want to avoid changing my data to set the label.

    Read the article

  • Using plist to populate a grouped table

    - by Jack Griffiths
    Hi there, I was wanting to use a plist to populate my grouped table. I've had a look at the DrillDownSave sample project, and I'm still none-the-wiser. Although, I did learn that I could store hierarchies and suchlike in there. So here's the questions: How can I use my plist to add new items to my grouped table? I'm currently feeding the table with an array, and I've noticed that an array isn't going to be the best thing for me. When a user taps on an item in the plist, how can I push the view to the corresponding item? In other words, how can I push the view based on the selected row (which was generated by the plist) to it's next "view"? If that makes any sense, please reply. Thanks, Jack.

    Read the article

  • current location too slow for view

    - by Christian
    Hi, I make an App with a Map in the App and a button to change to the google.Map-App. The code for my position is: -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { float avgAccuracy = (newLocation.verticalAccuracy + newLocation.horizontalAccuracy)/2.0; if (avgAccuracy < 500) { [locationManager stopUpdatingLocation]; locationManager.delegate = nil; } storedLocation = [newLocation coordinate]; The code for the view is: - (void)viewDidLoad { [super viewDidLoad]; UIImage *image = [UIImage imageNamed: @"LogoNavBar.png"]; UIImageView *imageview = [[UIImageView alloc] initWithImage: image]; UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithCustomView: imageview]; self.navigationItem.rightBarButtonItem = button; [imageview release]; [button release]; locationManager=[[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.distanceFilter = kCLDistanceFilterNone; [locationManager startUpdatingLocation]; mapView.showsUserLocation = YES; NSLog(@"storedLocation-latitude für MKregion: %f", storedLocation.latitude); MKCoordinateRegion region; region.center.latitude = (storedLocation.latitude + 45.58058)/2.0; region.center.longitude = (storedLocation.longitude - 0.546835)/2.0; region.span.latitudeDelta = ABS(storedLocation.latitude - 45.58058); region.span.longitudeDelta = ABS(storedLocation.longitude + 0.546835); [mapView setRegion:region animated:TRUE]; MKCoordinateRegion hotel; hotel.center.latitude = 45.58058; hotel.center.longitude = -0.546835; HotelPositionMarker* marker = [[HotelPositionMarker alloc] initWithCoordinate:hotel.center]; [mapView addAnnotation:marker]; [marker release]; } My problem: when the "viewDidLoad" start, the "storedLocation" is still 0.0000 it takes a bit longer to get the own position than to start the view. The Log for the "storedLocation" in the "viewDidLoad"-section is 0 while the Log of the "storedLocation" in the "-(IBAction)" when the map is visible contains the right values. How can I manage it to have my coordinates before the view load? I need them to center the view concerning the own position and the position given by me. MKCoordinateRegion region; region.center.latitude = (storedLocation.latitude + 45.58058)/2.0; region.center.longitude = (storedLocation.longitude - 0.546835)/2.0; region.span.latitudeDelta = ABS(storedLocation.latitude - 45.58058); region.span.longitudeDelta = ABS(storedLocation.longitude + 0.546835); [mapView setRegion:region animated:TRUE];

    Read the article

  • converting NSMutableData to NSMutableDictionary?

    - by senthilmuthu
    hi, i am accumulating data from NSMutableDictionary to NSMutabledata like NSMutableData *data = [receivedData objectForKey:@"tag1"]; and also data = [receivedData objectForKey:@"tag2"]; after this one , how can i get data for @"tag2" only from NSMutableData? NSMutableData tag2Data = [Data forKey:@"tag2"]; is not working?

    Read the article

  • Core data, sorting one-to-many child objects

    - by Shizam
    So if I have a store of parents children and the parent has a one to many relationship to children (parent.children) and they all have first names. Now, on the initial fetch for parents I can specify a sort descriptor to get them back in order of first name but how can I request the children in order? If I do a [parent.children allObjects] it just gives them back in a jumble and I'd have to sort after the fact, every time. Thanks, Sam

    Read the article

  • problem with custom NSProtocol and caching on iPhone

    - by TomSwift
    My iPhone app embeds a UIWebView which loads html via a custom NSProtocol handler I have registered. My problem is that resources referenced in the returned html, which are also loaded via my custom protocol handler, are cached and never reloaded. In particular, my stylesheet is cached: <link rel="stylesheet" type="text/css" href="./styles.css" /> The initial request to load the html in the UIWebView looks like this: NSString* strUrl = [NSMutableString stringWithFormat: @"myprotocol:///entry?id=%d", entryID ]; NSURL* url = [NSURL URLWithString: strUrl]; [_pCurrentWebView loadRequest: [NSURLRequest requestWithURL: url cachePolicy: NSURLRequestReloadIgnoringLocalCacheData timeoutInterval: 60 ]]; (note the cache policy is set to ignore, and I've verified this cache policy carries through to subsequent requests for page resources on the initial load) The protocol handler loads the html from a database and returns it to the client using code like this: // create the response record NSURLResponse *response = [[NSURLResponse alloc] initWithURL: [request URL] MIMEType: mimeType expectedContentLength: -1 textEncodingName: textEncodingName]; // get a reference to the client so we can hand off the data id client = [self client]; // turn off caching for this response data [client URLProtocol: self didReceiveResponse:response cacheStoragePolicy: NSURLCacheStorageNotAllowed]; // set the data in the response to our jfif data [client URLProtocol: self didLoadData:data]; [data release]; (Note the response cache policy is "not allowed"). Any ideas how I can make it NOT cache my styles.css resource? I need to be able to dynamically alter the content of this resource on subsequent loads of html that references this file. I thought clearing the shared url cache would work, but it doesnt: [[NSURLCache sharedURLCache] removeAllCachedResponses]; One thing that does work, but it's terribly inefficient, is to dynamically cache-bust the url for the stylesheet by adding a timestamp parameter: <link rel="stylesheet" type="text/css" href="./styles.css?ts=1234567890" /> To make this work I have to load my html from the db, search and replace the url for the stylesheet with a cache-busting parameter that changes on each request. I'd rather not do this. My presumption is that there is no problem if I were to load my content via the built-in HTTP protocol. In that case, I'm guessing that the UIWebView looks at any Cache-Control flags in the NSURLHTTPResponse object's http headers and abides by them. Since my NSURLResponseObject has no http headers (it's not http...) then perhaps UIWebView just decides to cached the resource (ignoring the NSURLRequest caching directive?). Ideas???

    Read the article

  • ScrollView content async downloading problem

    - by Newbee
    Hi! I have UIScrollView with lots of UIImageView inside. In the loadView method I assign some temporary image for each of subview UIImageView images and starts several threads to async download images from internet. Each thread downloads and assign images as follows: NSData *data = [NSData dataWithContentsOfURL:URL]; UIImage *img = [UIImage imageWithData:data]; img_view.image = img; Here is the problem - I expects picture will changed after each image downloaded by I can see only temporary images until all images will downloads. UIScrollView still interact while images downloads - I can scroll temporary images inside it and see scrollers and nothing blocks run loop, but downloaded images doesn't updates.. What I tried to do: Call sleep() in the download thread -- not helps. Call setNeedsDisplay for each ImageView inside ScrollView and for ScrollView -- not helps. What's wrong ? Thanks. Update. I tried some experiments with number of threads and number of images to download. Now I'm sure -- images redraws only when thread finished. For example - if I load 100 images with one thread -- picture updates one time after all images downloads. If I increase number of threads to 10 -- picture updates 10 times -- 10 images appears per update. One more update. I fixed problem by staring new thread from the downloading threads each time one image downloaded and exit current thread (instead of download several images in one thread in the cycle and exit thread only when all downloaded). Obviously it's not a good solution and there must be right approach.

    Read the article

  • Is memory leak caused by global variables?

    - by user297535
    When I checked my application for memory leaks it is showing 12 leaks. What will be the effect of this? I used global variables as shown below #import "file1.m" int num; #import "file2.m" extern int num; num = 10; Can this cause memory leaks? Anyone please help. I am a beginner in programming.

    Read the article

  • Releasing an app - Developed on one account, releasing/approving on another

    - by stumac85
    Hi there, We have developed an application for a company who want to release it under their own account. It has been developed on our account and has had provisioning profiles attached to it from our own account. What is the best way to do this? Do I have to send them the xCode project and talk them through how to attack a provisioning profile to the project? Or can I just get their login details and create a provisioning profile from the Mac in the office and do it for them? Or is there a "transfer to different account" option? Many thanks!

    Read the article

  • Prevent automatic popToRootViewController on double-tap of UITabBarController

    - by NilObject
    The default behavior of a UITabBarController is to pop the contained UINavigationController to the root view controller when a particular tab is tapped a second time. I have a particular use case where I'm wanting this to not work automatically, and I'm having a hard time figuring out how to prevent this. Has anyone run into this, and if so, what did you do? Do I need to subclass UINavigationController and override popToRootViewController or is there a simpler way?

    Read the article

  • How to retrieve Directories size including all sub-directories?

    - by vikingosegundo
    I have stored images from the net like this Documents/imagecache/domain1/original/path/inURI/foo.png Documents/imagecache/domain2/original/path/inURI/bar.png Documents/imagecache/... Documents/imagecache/... Now I'd like to check the size of imagecache including all it sub-directories. Is there a convenient way of doing it — preferable without crawling through all the data manually?

    Read the article

  • objc[989] objc_exception_throw failed.

    - by thyrgle
    I was just adding some more CCSprites to a CCLayer and it just starts crashing giving me the error: objc[989] objc_exception_throw failed. Is there like a limit to the amount of CCSprites you can have on a screen or something? I added the CCSprites doing the following with the CCSprites already declared at interface: L1Circle1 = [CCSprite spriteWithFile:@"LaserCircle.png"]; [L1Circle1 setPosition:ccp(180,180)]; [self addChild:L1Circle1]; What am I doing wrong?

    Read the article

  • setContentOffset only works if animated is set to YES

    - by Sheehan Alam
    I have a UITableView which I would like to be displayed 100px down. For some reason this only works when animated is set to YES. Why is this? - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; /*[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0] atScrollPosition:UITableViewScrollPositionNone animated:NO];*/ /*[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathWithIndex:1] atScrollPosition:UITableViewScrollPositionNone animated:NO];*/ [self.tableView setContentOffset:CGPointMake(0,100) animated:YES]; }

    Read the article

  • Xib view file is not working in landscape mode

    - by senthilmuthu
    Hi, I have added new Xib view file in my project. I assigned to view controller and in the view controller I set: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { //return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); return YES; } But when the application runs in landscape mode, xib is not in landscape mode. I have set in info.plist file also xib file is also in landscape view. What do I have to do? Any help?

    Read the article

  • "Expected specifier-quantifier-list before b2Body" error in XCode

    - by Zeophlite
    I'm trying to derive class from CCSprite to store the sprites reference to its corresponding b2Body, but I've get the following errors (comments in Code) BoxSprite.h #import <Foundation/Foundation.h> #import "Box2D.h" #import "cocos2d.h" @interface BoxSprite : CCSprite { b2Body* bod; // Expected specifier-quantifier-list before b2Body } @property (nonatomic, retain) b2Body* bod; // Expected specifier-quantifier-list before b2Body @end // Property 'bod' with 'retain' attribute must be of object type BoxSprite.m #import "BoxSprite.h" @implementation BoxSprite @synthesize bod; // No declaration of property 'bod' found in the interface - (void) dealloc { [bod release]; // 'bod' undeclared [super dealloc]; } @end I was hoping to create the sprite and assign the body with: BoxSprite *sprite = [BoxSprite spriteWithBatchNode:batch rect:CGRectMake(32 * idx,32 * idy,32,32)]; ... sprite->bod = body; // Instance variable 'bod' is declared protected Then access the b2Body by: if ([node isKindOfClass:[BoxSprite class]]) { BoxSprite *spr = (BoxSprite*)node; b2Body *body = spr->bod; // Instance variable 'bod' is declared protected ... }

    Read the article

< Previous Page | 141 142 143 144 145 146 147 148 149 150 151 152  | Next Page >