Search Results

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

Page 151/763 | < Previous Page | 147 148 149 150 151 152 153 154 155 156 157 158  | Next Page >

  • UITextView autoscroll to last line

    - by MihaiD
    Hi *, When writing in a UITextView more text than can fit entirely inside it, the text will scroll up and the cursor will often place itself one or two lines above the view's bottom line. This is a bit frustrating as I want my application to make good use of the entire height of the text view. Basically what I want is to configure the UITextView to write up to it's lowest part and not use it just for scrolling. I've seen some similar questions here, here and here. However I've not seen a proper solution yet. Thanks

    Read the article

  • MPMoviePlayerController on large videos causes massive memory spike, and a level 1 memory warning

    - by Shizam
    When viewing images my application hums along nicely with low memory consumption, once I try to watch a video using MPMoviePlayerController memory usage spikes way up, dwarfing the previous memory graph and if I play the video it causes a 'memory warning. Level=1' message. The video files (mp4) aren't even that big, 40MB or so, and it doesn't matter if I play the file streamed from a URL or loaded from a local file, actually the memory spike is even worse if I try to stream it. Here is the code I use to create the player: if (_photo.videoPath != nil) { _movieViewController=[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:_photo.videoPath]]; } else { _movieViewController=[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:_photo.videoURL]]; } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoMetaListener:) name:MPMovieDurationAvailableNotification object:_movieViewController.moviePlayer]; _movieViewController.moviePlayer.scalingMode=MPMovieScalingModeAspectFit; _movieViewController.moviePlayer.shouldAutoplay = YES; _movieViewController.moviePlayer.controlStyle = MPMovieControlStyleEmbedded; Anybody else running into issues playing video? Also I checked for leaks, there are none reported.

    Read the article

  • Figuring Out Memory Leaks without Clang

    - by RoLYroLLs
    I'm trying to see if I can find some leaks myself in Apple's TopSongs app. Can someone help me out in at least one and how to identify what is in the Leaks reports and how I can get an idea on finding them? ie: I got one like this: # Category Event Type Timestamp Address Size Responsible Library Responsible Caller 0 GeneralBlock-448 Malloc 00:02.185 0x3f41220 448 libxml2.2.dylib xmlNewParserCtxt From what I can tell, the method xmlNewParserCtxt is the problem, and it's not releasing an object, hence Malloc. The responsible library tells me it's the libxml2.2.dylib library with the problem, which I can't edit. Am I heading in the right direction? If so, half the leaks are in that library and well, i can't edit that.

    Read the article

  • UITableView custom popping

    - by ckrames1234
    Okay, I made an app that has a list of items as a main view, and when you select an item it pushes a detail view controller. In this detail view controller you can switch between items. I want to be able to push a view, scroll a few items, and pop the view as if the current item was initially selected. I want to push a view, and then when i pop it, i want it to look like a different view was initially pushed. Here's a rough image, because its hard to explain in writing: http://96.248.81.29:83/misc/PushPopSituation.png (Thats a fixed IP, its not going anywhere) If anyone knows how I could do something like this, it would be a great help to me.

    Read the article

  • how to draw a NSString in drawrect of UIView?

    - by senthilmuthu
    hi, the Newline character is not working in draw rect of UIView? can anyone help? - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); UIFont * f = [UIFont systemFontOfSize:20]; [[UIColor darkGrayColor] set]; CGRect b = [self bounds]; NSString * text = @"hi \nr u"; CGSize sz = CGSizeMake(150,200); CGContextScaleCTM(context, b.size.width/sz.width, b.size.height/sz.height); [text drawAtPoint:CGPointMake(0,0) withFont:f]; }

    Read the article

  • Why is setting queue in a MPMusicPlayerController only adding first track in collection?

    - by prendio2
    I have an Album object containing a MPMediaItemCollection of the album's tracks. When I add this collecton to the queue with the following line of code, only the first track gets added. [iPodMusicPlayer setQueueWithItemCollection:album.mediaItems]; Oddly enough when I add with the following line of code, everything works as expected. [iPodMusicPlayer setQueueWithItemCollection:[MPMediaItemCollection collectionWithItems:[album.mediaItems items]]]; Why would the second line work but not the first?

    Read the article

  • game state singleton cocos2d, initWithEncoder always returns null

    - by taber
    Hi, I'm trying to write a basic test "game state" singleton in cocos2d, but for some reason upon loading the app, initWithCoder is never called. Any help would be much appreciated, thanks. Here's my singleton GameState.h: #import "cocos2d.h" @interface GameState : NSObject <NSCoding> { NSInteger level, score; Boolean seenInstructions; } @property (readwrite) NSInteger level; @property (readwrite) NSInteger score; @property (readwrite) Boolean seenInstructions; +(GameState *) sharedState; +(void) loadState; +(void) saveState; @end ... and GameState.m: #import "GameState.h" #import "Constants.h" @implementation GameState static GameState *sharedState = nil; @synthesize level, score, seenInstructions; -(void)dealloc { [super dealloc]; } -(id)init { if(!(self = [super init])) return nil; level = 1; score = 0; seenInstructions = NO; return self; } +(void)loadState { @synchronized([GameState class]) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *saveFile = [documentsDirectory stringByAppendingPathComponent:kSaveFileName]; Boolean saveFileExists = [[NSFileManager defaultManager] fileExistsAtPath:saveFile]; if(!sharedState) { sharedState = [GameState sharedState]; } if(saveFileExists == YES) { [sharedState release]; sharedState = [[NSKeyedUnarchiver unarchiveObjectWithFile:saveFile] retain]; } // at this point, sharedState is null, saveFileExists is 1 if(sharedState == nil) { // this always occurs CCLOG(@"Couldn't load game state, so initialized with defaults"); sharedState = [self sharedState]; } } } +(void)saveState { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *saveFile = [documentsDirectory stringByAppendingPathComponent:kSaveFileName]; [NSKeyedArchiver archiveRootObject:[GameState sharedState] toFile:saveFile]; } +(GameState *)sharedState { @synchronized([GameState class]) { if(!sharedState) { [[GameState alloc] init]; } return sharedState; } return nil; } +(id)alloc { @synchronized([GameState class]) { NSAssert(sharedState == nil, @"Attempted to allocate a second instance of a singleton."); sharedState = [super alloc]; return sharedState; } return nil; } +(id)allocWithZone:(NSZone *)zone { @synchronized([GameState class]) { if(!sharedState) { sharedState = [super allocWithZone:zone]; return sharedState; } } return nil; } ... -(void)encodeWithCoder:(NSCoder *)coder { [coder encodeInt:level forKey:@"level"]; [coder encodeInt:score forKey:@"score"]; [coder encodeBool:seenInstructions forKey:@"seenInstructions"]; } -(id)initWithCoder:(NSCoder *)coder { CCLOG(@"initWithCoder called"); self = [super init]; if(self != nil) { CCLOG(@"initWithCoder self exists"); level = [coder decodeIntForKey:@"level"]; score = [coder decodeIntForKey:@"score"]; seenInstructions = [coder decodeBoolForKey:@"seenInstructions"]; } return self; } @end ... I'm saving the state on app exit, like this: - (void)applicationWillTerminate:(UIApplication *)application { [GameState saveState]; [[CCDirector sharedDirector] end]; } ... and loading the state when the app finishes loading, like this: - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ... [GameState loadState]; ... } I've tried moving around where I call loadState too, for example in my main CCScene, but that didn't seem to work either. Thanks again in advance.

    Read the article

  • How to change image and disable UIBarButtonItem

    - by Alex
    I have a NavigationBar app with two views: a parent and a sub view. In the sub view I'm adding a button to the right corner as follows: - (void)viewDidLoad { UIBarButtonItem *tempButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"lock-unlocked.png"] style:UIBarButtonItemStylePlain target:self action:@selector(lockScreen)]; self.navigationItem.rightBarButtonItem = tempButton; [tempButton release]; } When that button is clicked I want to change the image of this rightBarButtonItem and disable the leftBarButtonItem (which was added automatically by the controller). Basically have two states of a button, locked and unlocked. Question 1: The only way I can find how to change the image is to create a new UIButtonItem with a new image and replace rightBarButtonItem with that new one. But I'm wondering if there's a way to just change the image without creating a new UIBarButtonItem. Am I creating a memory leak if I keep creating new UIBarButtonItem? Question 2: How can I get a hold of self.navigationItem.leftBarButtonItem and disable/enable it? I don't create that one manually, it's created automatically for me by the controller. I don't see any method/property on UIBarButtonItem to enable/disable user interaction with it.

    Read the article

  • Access UIButton's titleLabel with custom background image

    - by Meltemi
    Quick one: I have a custom button image that I want to use but I still want to change the text of the button with setTitle:forState:. When I use a "custom" button in IB I lose the Title view. When I use Rounded Rect in IB the custom image appears scrunched w/in the Rounded Rect button. Why is this so difficult?

    Read the article

  • CATiledLayer: Determining levelsOfDetail when in drawLayer

    - by Russell Quinn
    I have a CATiledLayer inside a UIScrollView and all is working fine. Now I want to add support for showing different tiles for three levels of zooming. I have set levelsOfDetail to 3 and my tile size is 300 x 300. This means I need to provide three sets of tiles (I'm supplying PNGs) to cover: 300 x 300, 600 x 600 and 1200 x 1200. My problem is that inside "(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx" I cannot work out which levelOfDetail is currently being drawn. I can retrieve the bounds currently required by using CGContextGetClipBoundingBox and usually this requests a rect for one of the above sizes, but at layer edges the tiles are usually smaller and therefore this isn't a good method. Basically, if I have set levelsOfDetail to 3, how do I find out if drawLayer is requesting level 1, 2 or 3 when it's called? Thanks, Russell.

    Read the article

  • how to display image in MFMailComposer?

    - by Rahul Vyas
    Hello all i want to display an image in mfmailcomposer it shows when i add it to attachment but not at the exact place where i want to show it how do i show image in mfmailcomposer. also does someone knows how to launch safari when click on a url in mfmailcomposer?

    Read the article

  • How can we add text in cocos2d by using UITextView ?

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

    Read the article

  • Where to change data for a "list" datasource in dashcode?

    - by erotsppa
    I created a new project in dashcode and it automatically generated a mobile web app for me with a list and sample datasources. I see two datasources, one is labeled as "datasource" and the other is "list". However I can see that the actual data in datasources is in a js file, everything is good but where is the actual data stored for "list"? The sample application came with a bunch of data for "list" and I am unable to change it. Any ideas?

    Read the article

  • Hitting the Done button does not dismiss the View of a MPMoviePlayerController on OS 4.0 beta

    - by Hakim
    Hi All Hope someone can help me on this, on the old OS version 3.0 and down , hitting the done button one playing a Video would automatically dismiss the view, but now since we have to control the view appearance, hitting the Done just stops the movie but does not dismiss the view, I tried to check if it was linked to any notification and found that each time the Done button was hit, MPMoviePlayerPlaybackStateDidChangeNotification is triggered the problem is that the same notification is received for any change of state pausing /playing... so dismissing the view when MPMoviePlayerPlaybackStateDidChangeNotification is triggered is not an option. does anyone have an answer for this problem Thx for your help

    Read the article

  • CGContextDrawPDFPage taking up large amounts of memory

    - by Ed Marty
    I have a PDF file that I want to draw in outline form. I want to draw the first several pages on the document each in their own UIImage to use on a button so that when clicked, the main display will navigate to the clicked page. However, CGContextDrawPDFPage seems to be using copious amounts of memory when attempting to draw the page. Even though the image is only supposed to be around 100px tall, the application crashes while drawing one page in particular, which according to Instruments, allocates about 13 MB of memory just for the one page. Here's the code for drawing: //Note: This is always called in a background thread, but the autorelease pool is setup elsewhere + (void) drawPage:(CGPDFPageRef)m_page inRect:(CGRect)rect inContext:(CGContextRef) g { CGPDFBox box = kCGPDFMediaBox; CGAffineTransform t = CGPDFPageGetDrawingTransform(m_page, box, rect, 0,YES); CGRect pageRect = CGPDFPageGetBoxRect(m_page, box); //Start the drawing CGContextSaveGState(g); //Clip to our bounding box CGContextClipToRect(g, pageRect); //Now we have to flip the origin to top-left instead of bottom left //First: flip y-axix CGContextScaleCTM(g, 1, -1); //Second: move origin CGContextTranslateCTM(g, 0, -rect.size.height); //Now apply the transform to draw the page within the rect CGContextConcatCTM(g, t); //Finally, draw the page //The important bit. Commenting out the following line "fixes" the crashing issue. CGContextDrawPDFPage(g, m_page); CGContextRestoreGState(g); } Is there a better way to draw this image that doesn't take up huge amounts of memory?

    Read the article

  • Horizontal UITableView

    - by imran
    I want implement a layout in my ipad application that has a uitable view that scrolls left and right rather then up and down : So rather than row 1 row 2 row 3 ( scrolling vertically ) It would be : row 1, row2, row 3 (scrolling horizontally ) I've seen that UItableView is designed to only do vertical scrolling so doing a transform does not give the desired effect. Is there a standard way to do this taking advantage of a datasource provider like uitableview provides? I basically want to do somthing similar to what the BBC News reader app ( http://itunes.apple.com/us/app/bbc-news/id364147881?mt=8 ) on the Ipad does with the list of stories to select from. Thanks

    Read the article

  • MPMoviePlayerController problem when play a movie

    - by Momeks
    hi .. i put a movie when my application will lunch . just like gameloft games . so when application has lunched , movie plays fine but before the move plays .. my FirstViewController xib file show first then moview start to play ! why ? here is my code : - (void)applicationDidFinishLaunching:(UIApplication *)application { NSBundle *bundle = [NSBundle mainBundle]; NSString *moviePath = [bundle pathForResource:@"movie" ofType:@"m4v"]; NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain]; MPMoviePlayerController *IntroMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; IntroMovie.movieControlMode = MPMovieControlModeHidden; [IntroMovie play]; }

    Read the article

  • Using NSXMLParser with CDATA

    - by Robb
    I'm parsing an RSS feed with NSXMLParser and it's working fine for the title and other strings but one of the elements is an image thats like <!CDATA <a href="http:image..etc> How do I add that as my cell image in my table view? Would I define that as an image type? This is what i'm using to do my parsing: - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{ //NSLog(@"found this element: %@", elementName); currentElement = [elementName copy]; if ([elementName isEqualToString:@"item"]) { // clear out our story item caches... item = [[NSMutableDictionary alloc] init]; currentTitle = [[NSMutableString alloc] init]; currentDate = [ [NSMutableString alloc] init]; currentSummary = [[NSMutableString alloc] init]; currentLink = [[NSMutableString alloc] init]; } } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ //NSLog(@"ended element: %@", elementName); if ([elementName isEqualToString:@"item"]) { // save values to an item, then store that item into the array... [item setObject:currentTitle forKey:@"title"]; [item setObject:currentLink forKey:@"link"]; [item setObject:currentSummary forKey:@"description"]; [item setObject:currentDate forKey:@"date"]; [stories addObject:[item copy]]; NSLog(@"adding story: %@", currentTitle); } } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{ //NSLog(@"found characters: %@", string); // save the characters for the current item... if ([currentElement isEqualToString:@"title"]) { [currentTitle appendString:string]; } else if ([currentElement isEqualToString:@"link"]) { [currentLink appendString:string]; } else if ([currentElement isEqualToString:@"description"]) { [currentSummary appendString:string]; } else if ([currentElement isEqualToString:@"pubDate"]) { [currentDate appendString:string]; } }

    Read the article

  • How to follow user location with MapKit

    - by Bloudermilk
    I'm using MapKit to display the user's location relative to pins around them. I'd like to be able to mimic the functionality that Maps provides via the crosshair button in the lower left-hand corner of the screen. I'm already aware that MapKit provides a CLLocation object with the user's location via MKUserLocation, I just wanted to seek advice on how I should keep focus on that location. My initial inclination was to use an NSTimer to center the map on that coordinate every 500ms or so. Is there a better way to do this? Is there something built in to MapKit that I'm missing that will accomplish this? Thanks so much, Brendan

    Read the article

  • Why is no video showing using MPMoviePlayerController

    - by nathanjosiah
    MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://feeds.harvest.org/~r/greglaurietv/~5/MW4zfyeubC8/HD100307-iPod.mp4"]]; moviePlayer.scalingMode = MPMovieScalingModeNone; moviePlayer.controlStyle = MPMovieControlStyleDefault; [moviePlayer play]; only audio is playing, but nothing shows up in my view.... what am i doing wrong?

    Read the article

< Previous Page | 147 148 149 150 151 152 153 154 155 156 157 158  | Next Page >