Search Results

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

Page 159/763 | < Previous Page | 155 156 157 158 159 160 161 162 163 164 165 166  | Next Page >

  • NSLog(@"%@",super) crashing

    - by Chandan Shetty SP
    I used NSLog(@"%@",super) in a method(any method) and it is crashing.... Why? How to print the super contents? Updated : currentclassname : superClassName { } and also if i use NSLog(@"%@", [super description]); It is printing "<currentclassname: 0x3db7230>" instead of superClassName... It is expected to print superClassName right. Thanks in advance,

    Read the article

  • NSURLConnection still calls delegate AFTER cancel method has been called

    - by Shizam
    Hi All, Having a problem with NSURLConnection, if I create a NSURLConnection and call [connection connectionWithRequest] let it load a little then call [connection cancel] most of the time that works fine. However occasionally even after I call [connection cancel] the connection's delegate still gets called (which crashes the app). Googling around it looks like the problem here is a race condition in the runloop, I cancel the connection and release the delegate but before the runloop cycles it calls the delegate functions - crash. Is there a way for me to, after I call [connection cancel] confirm the connection has actually canceled? Even a crappy while() loop will do :(

    Read the article

  • UITableView resizing rows problem

    - by Vin
    Hi All, Hope to get solution to this problem. I have been stuck on it since a long time now. I have a a tableView which has custom labels drawn upon the cell using CGRect. I receive the data from a web service in arrays. Initially i display a line of data on the cells. When the user selects a cell, I call reloadsRowAtIndexPath to increase the height of selected row. In the process, cellForRowAtIndexPath gets called again. I keep track of this by a flag, and when cellForRowAtIndexPath gets called again, I display the two more lines of data from arrays, on the cell. What i am getting is all overlapping data on one other. I tried to remove already placed labels in didSelectRowAtIndexPath, but to no avail. Please help me on this Thanks in advance.

    Read the article

  • How can we change color of a text programmatically ?

    - by user297535
    My code is -(UIImage *)addText:(UIImage *)img text:(NSString *)text1{ int w = img.size.width; int h = img.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextDrawImage(context, CGRectMake(0, 0, w, h), img.CGImage); CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1); char* text = (char *)[text1 cStringUsingEncoding:NSASCIIStringEncoding]; CGContextSelectFont(context, "Arial", 18, kCGEncodingMacRoman); CGContextSetTextDrawingMode(context, kCGTextFill); CGContextSetRGBFillColor(context, 255, 255, 255, 2); CGContextShowTextAtPoint(context, 10, 170, text, strlen(text)); CGImageRef imageMasked = CGBitmapContextCreateImage(context); CGContextRelease(context); CGColorSpaceRelease(colorSpace); return [UIImage imageWithCGImage:imageMasked]; } -(UIImage *)addText:(UIImage *)img text:(NSString *)text1{ int w = img.size.width; int h = img.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextDrawImage(context, CGRectMake(0, 0, w, h), img.CGImage); CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1); char* text = (char *)[text1 cStringUsingEncoding:NSASCIIStringEncoding]; CGContextSelectFont(context, "Arial", 18, kCGEncodingMacRoman); CGContextSetTextDrawingMode(context, kCGTextFill); CGContextSetRGBFillColor(context, 255, 255, 255, 2); CGContextShowTextAtPoint(context, 10, 170, text, strlen(text)); CGImageRef imageMasked = CGBitmapContextCreateImage(context); CGContextRelease(context); CGColorSpaceRelease(colorSpace); return [UIImage imageWithCGImage:imageMasked]; } How can we change the color of the text programmatically? Answers will be greatly appreciated!

    Read the article

  • UITableViewCell with selectable/copyable text that also detects URLs on the iPhone

    - by Jasarien
    Hi guys, I have a problem. Part of my app requires text to be shown in a table. The text needs to be selectable/copyable (but not editable) and any URLs within the text need to be highlighted and and when tapped allow me to take that URL and open my embedded browser. I have seen a couple of solutions that solve one of either of these problems, but not both. Solution 1: Icon Factory's IFTweetLabel The first solution I tried was to use the IFTweetLabel class made possible by Icon Factory and used in Twitterrific. While this solution allows for links (or anything you can find with a regex) to be detected to be handled on a case by case basis, it doesn't allow for selecting and copying. There is also an issue where if a URL is long enough to be wrapped, the button that the class overlays above the URL to make it interactive cannot wrap and draws off screen, looking very odd. Solution 2: Use IFTweetLabel and handle copy manually The second thing I tried was to keep IFTweetLabel in place to handle the links, but to implement the copying using a long-tap gesture, like how the SMS app handles it. This was just about working, but it doesn't allow for arbitrary selection of text, the whole text is copied, or none is copied at all... Pretty black and white. Solution 3: UITextView My third attempt was to add a UITextView as a subview of the table cell. The only thing that this doesn't solve is the fact that detected URLs cannot be handled by me. The text view uses UIApplication's openURL: method which quits my app and launched Safari. Also, as the table view can get quite large, the number of UITextViews added as subviews cause a noticeable performance drag on scrolling throughout the table, especially on iPhone 3G era devices (because of the creation, layout, compositing whenever a cell is scrolled on screen, etc). So my question to all you knowledgeable folk out there is: What can I do? Would a UIWebView be the best option? Aside from a performance drag, I think a webview would solve all the above issues, and if I remember correctly, back in the 2.0 days, the Apple documentation actually recommended web views where text formatting / hyperlinks were required. Can anyone think of a way to achieve this without a performance drag? Many thanks in advance to everyone who can help.

    Read the article

  • Iphone App crashing on launch

    - by Declan Scott
    Hey, My simple iphone app is crashing on launch, it says "the application downloadText quit unexcpectedly i none of these windows that pop up when a mac app crashes and has a send to Apple button. My .h is below and i would greatly appreciate it if anyone could give me a hand as to what's wrong? thanks, Declan `#import "downloadTextViewController.h" @implementation downloadTextViewController // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { NSString *myPath = [self saveFilePath]; NSLog(myPath); BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:myPath]; if (fileExists) { NSArray *values = [[NSArray alloc] initWithContentsOfFile:myPath]; textView.text = [values objectAtIndex:0]; [values release]; } // notification UIApplication *myApp = [UIApplication sharedApplication]; // add yourself to the dispatch table [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:UIApplicationWillTerminateNotification object:myApp]; [super viewDidLoad]; } (IBAction)fetchData { /// Show activityIndicator / progressView NSURLRequest *downloadRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://simpsonatyapps.com/exampletext.txt"] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:1.0]; NSURLConnection *downloadConnection = [[NSURLConnection alloc] initWithRequest:downloadRequest delegate:self]; if (downloadConnection) downloadedData = [[NSMutableData data] retain]; else { /// Error message } } (void)connection:(NSURLConnection *)downloadConnection didReceiveData:(NSData *)data { [downloadedData appendData:data]; NSString *file = [[NSString alloc] initWithData:downloadedData encoding:NSUTF8StringEncoding]; textView.text = file; /// Remove activityIndicator / progressView [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1]; } (NSString *) saveFilePath { NSArray *pathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); return [[pathArray objectAtIndex:0] stringByAppendingPathComponent:@"savedddata.plist"]; } (void)applicationWillTerminate:(UIApplication *)application { NSArray *values = [[NSArray alloc] initWithObjects:textView.text,nil]; [values writeToFile:[self saveFilePath] atomically:YES]; [values release]; } (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } (void)dealloc { [super dealloc]; } (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse { return nil; } @end `

    Read the article

  • Understanding CABasicAnimation when spinning an object from a random angle....

    - by user157733
    I have spent ages trying to figure this out and I am still having problems. I want to rotate an image a random number of time - say 5 and a bit - then have it stop. I then want to rotate it again FROM ITS STOPPED POSITION. I am having difficulty with this so maybe someone can advise me on the right way to do it. Ok so I am using a CABasicAnimation for the spin like this... CABasicAnimation* rotationAnimation; rotationAnimation = [NSNumber numberWithFloat: 0.0]; rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 1.0]; rotationAnimation.duration = 100; rotationAnimation.cumulative = YES; rotationAnimation.repeatCount = 5.2; rotationAnimation.removedOnCompletion = NO; rotationAnimation.fillMode = kCAFillModeForwards; [myView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"]; This works fine. I use a animationDidStop function to transform the image to the new angle so that it actually in the new position (not just appearing that way). This is where my problems start. I have tried the following... removing the toValue line which means the animation starts from where it currently is but when the animation block is repeated it jumps back to this start position every time the block is run storing the value of the end rotation and using this in the toValue so the 2 lines of code become... rotationAnimation = [NSNumber numberWithFloat: previousVal]; rotationAnimation.toValue = [NSNumber numberWithFloat: (M_PI * 1.0)+previousVal]; when I do this the animation still jumps because it is flicking back to the previousVal everytime the block is repeated Therefore my final thought is to check to see if the image is at zero, if not then rotate it to zero, then impliment the block of code to spin multiple times. This seems complicated but is this the ONLY way to achieve this? I am concerned about getting the timings smooth with this method. Any suggestions would be amazing! Thanks

    Read the article

  • disable javascript in a UIWebView

    - by adrien Coye
    Hi, Is there a way to disable the Javascript in a UIwebView ? I have memory consumption problem, and I'm looking for a trick here because it seems to not be be possible with the official stuff. Maybe a call with javascript can stop javascript itself, i don't know. Thanks in advance for any help, Adrian C

    Read the article

  • MFMailComposeViewController broke CSS styles in html template

    - by Victor
    I use MFMailComposeViewController to send a message in html format. If my html template contains the css styles: <div class="margin:10 10 10 0"> <a href="domain.name">Go To</a></div> In this case it works good. But if I send: <a href="domain.name">Go&nbsp;To</a> then I see the letter that comes with broken styles as there (3D is not my misprint) <div style=3D"margin:10 10 10 10;"><a href=3D"www.google.com">Go=C2=A0To</a></div> Well as the letter goes broken when I insert in the template symbols from national alphabets. Somebody can tell what the problem and check with yourself?

    Read the article

  • Adding view to UIScrollView and toggling scrolling/interacting

    - by Peter Hajas
    Hi all! I have a UIScrollView in my project. I have a view controller I would like to add as a child of the UIScrollview. Would I just do that like this: [scrollView addSubview:theViewController.view]; or is there a better way? (theView is a view, not the TV show) Furthermore, I would like to be able to use a UIButton in scrollView's parent view controller to toggle whether or not the user is scrolling with scrollView and NOT interacting with theView or NOT scrolling with scrollview and interacting with theView. Should I just have that set the property: scrollView.userInteractionEnabled = NO; or would that disable interaction with theView because it's a child? Thanks for your help!

    Read the article

  • NavigationController pushViewController problems.

    - by Jacek
    Hello. I have created new a view controller in my project (ActivateController). I have added it to the interface of the parent view controller (PrefsViewController): #import <UIKit/UIKit.h> #import "ActivateController.h" @interface PrefsViewController : UIViewController <UITextFieldDelegate> { ActivateController *activateController; } -(IBAction)pressedActivate; @property(nonatomic,retain) IBOutlet ActivateController *activateController; @end I have also added it to parent's controller nib (and changed it type to ActivateController), and connected it to IBOutlet ActivateController. But still, when I perform (on pressedActivate): [self.navigationController pushViewController:activateController animated:YES]; Nothing happens. I have done it successfully many times before. What might be wrong? P.S. pressedActivate is executed for sure (I used NSLog to check).

    Read the article

  • NSFetchedResultsController titleForHeaderInSection with formatted NSDate

    - by Daniel Granger
    In my Core Data app I am using a FetchedResultsController. Usually to set titles for headers in a UITableView you would implement the following method like so: - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { id <NSFetchedResultsSectionInfo> sectionInfo = [[<#Fetched results controller#> sections] objectAtIndex:section]; return [sectionInfo name]; } where [sectionInfo name] returns a NSString. my sectionKeyPath is based on an NSDate and this all works fine apart from the section headers it gives me are the raw date description strings (e.g. 12/12/2009 12:32:32 +0100) which look a bit of a mess in a header! So I want to use a date formatter on this to make a nice header like "Apr 17 2010" but I can't do that with the [sectionInfo name] as this is NSString! Any Ideas? Many Thanks

    Read the article

  • NSDateFormatter incorrect date on simulator, correct date on device

    - by Rudiger
    Hi, Im building a calendar and to find out the first day of the month I do [formatter setDateFormat:@"e"]; int startDay = [[formatter stringFromDate:newDate] intValue]; On the device this works correctly and the 1st of the month is on the correct day. But on the simulator it is the day after. Although it doesn't overly matter about the simulator it is kind of driving me crazy thinking I've done something wrong. I tried to set the locale of the formatter but no difference, nor i think should it. Can anyone shed some light on this? On a side note is there a better way to build a calendar than this?

    Read the article

  • ASIHttpRequest problems. "unrecognized selector sent to instance"

    - by Paul Peelen
    Hi, I am experiencing problems using ASIHttpRequst. This is the error I get: 2010-04-11 20:47:08.176 citybikesPlus[5885:207] *** -[CALayer rackDone:]: unrecognized selector sent to instance 0x464a890 2010-04-11 20:47:08.176 citybikesPlus[5885:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[CALayer rackDone:]: unrecognized selector sent to instance 0x464a890' 2010-04-11 20:47:08.176 citybikesPlus[5885:207] Stack: ( 33936475, 2546353417, 34318395, 33887862, 33740482, 126399, 445238, 33720545, 33717320, 40085013, 40085210, 3108783, 11168, 11022 ) And this is my code (Part of it): // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [image setImage:[UIImage imageNamed:@"bullet_rack.png"]]; BikeAnnotation *bike = [[annotationView annotation] retain]; bike._sub = @""; [super viewDidLoad]; NSString *newUrl = [[NSString alloc] initWithFormat:rackUrl, bike._id]; NSString *fetchUrl = [newUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; [networkQueue cancelAllOperations]; [networkQueue setRequestDidFinishSelector:@selector(rackDone:)]; [networkQueue setRequestDidFailSelector:@selector(processFailed:)]; [networkQueue setDelegate:self]; ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:fetchUrl]] retain]; [request setDefaultResponseEncoding:NSUTF8StringEncoding]; [networkQueue addOperation:request]; [networkQueue go]; } - (void)rackDone:(ASIHTTPRequest *)request { NSString *resultSearch = [request responseString]; NSData *data = [resultSearch dataUsingEncoding:NSUTF8StringEncoding]; NSString *errorDesc = nil; NSPropertyListFormat format; NSDictionary * dict = (NSDictionary*)[NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&errorDesc]; rackXmlResult* fileResult = [[[rackXmlResult alloc] initWithDictionary:dict] autorelease]; rackXmlSet *rackSet = [fileResult getRackResult]; NSString *subString = [[NSString alloc] initWithFormat:@"Cyklar tillgängligt: %@ -- Lediga platser: %@", rackSet._ready_bikes, rackSet._empty_locks]; [activity setHidden:YES]; [image setHidden:NO]; BikeAnnotation *bike = [annotationView annotation]; bike._sub = subString; } - (void) processFailed:(ASIHTTPRequest *)request { UIAlertView *errorView; NSError *error = [request error]; NSString *errorString = [error localizedDescription]; errorView = [[UIAlertView alloc] initWithTitle: NSLocalizedString(@"Network error", @"Network error") message: errorString delegate: self cancelButtonTitle: NSLocalizedString(@"Close", @"Network error") otherButtonTitles: nil]; [errorView show]; [errorView autorelease]; } The process is loaded as LeftCalloutView in the callout bubble when annotations are loaded in my mapview, so quite a lot (80 times or so). It is meant to retrieve a XML Plist from a server, parse it and use the data... but it dies at the rackDone: Does anybody have any ideas? Regards, Paul Peelen

    Read the article

  • How to add Timer to loop.

    - by mukeshpawar
    how to add timer to loop. i am making a urlConnection so i want that the loop execute for a time and if there is no connection it should exit. Does it work..... [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1f]]; Thanks in advance.

    Read the article

  • UIKeyboard turn Caps Lock on

    - by Daniel Granger
    I need my user to input some data like DF-DJSL so I put this in the code: theTextField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters; But unfortunately what happens is the first to letter type in CAPS but then letter immediately after typing the hyphen will be in lower case and then the rest return to CAPS therefore producing output like this (unless the user manually taps the shift button after typing a hyphen): DF-dJSL How can I fix this? Many Thanks

    Read the article

  • Application get crash while using NSAutoreleasepool inside MKMapview regionDidChangeAnimated method

    - by Ram
    Hi, i am working on a map application, in that i like to drop the pins (as in Zillow apps) when ever user change the map view. I am using following code code. i am try to load the xml data from server using NSAutoreleasepool to do the xml parsing in the background thread. (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated{ NSLog(@"inside region did changed "); urlString =[NSString stringWithFormat: @"http://asdfasdasdf.com/asdfasdf/mapxml.php]; [stories1 release]; [mapview removeAnnotations:eventPoints1]; eventPoints1 = [[NSMutableArray array] retain]; [self performSelectorInBackground:@selector(callParsing) withObject:nil]; } -(void)callParsing{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [self parseXMLFileAtURL:urlString]; [self performSelectorOnMainThread:@selector(droppingPin) withObject:nil waitUntilDone:YES]; [pool drain]; } The above code is working fine, but once i changed the mapview, the appllication get crashed. Anyone can help me to fix the issue? thanks in advance.

    Read the article

< Previous Page | 155 156 157 158 159 160 161 162 163 164 165 166  | Next Page >