Search Results

Search found 451 results on 19 pages for 'nsbundle'.

Page 7/19 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Can not read and save a number from/into an .plist

    - by Flocked
    Hello, I created a property list with the name propertys.plist. Then I wrote this: NSString *path = [[NSBundle mainBundle] bundlePath]; NSString *finalPath = [path stringByAppendingPathComponent:@"speicherung.plist"]; NSMutableArray *plistData = [[NSMutableArray arrayWithContentsOfFile:finalPath] retain]; int a = [plistData objectAtIndex:1]; NSLog(@"%i", a); // returns 41386032, but the right number is 0 a = a + 1; NSNumber *ff = [NSNumber numberWithInt:a]; [plistData insertObject:ff atIndex:1]; NSLog(@"%@", [plistData objectAtIndex:1]); // returns 41386033 [plistData writeToFile:finalPath atomically:YES]; My app always get the wrong number. Why?

    Read the article

  • How do I display a local html file in a UIWebView?

    - by Thomas
    I have a relatively simple question that I cannot seem to find the answer for. While doing the Google Maps Java API Tutorials, I ran into a problem. I can load an HTML file from the web, but when I try it locally, it just displays the contents of the file instead of running the script. Here's what works: NSString *url = @"http://code.google.com/apis/maps/documentation/v3/examples/geocoding-simple.html"; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; [webView loadRequest:request]; I want to store the HTML file locally and run it from the device itself, so I tried: [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"geocoding-simple" ofType:@"html"]isDirectory:NO]]]; and it just displayed the contents of the file. What am I doing wrong here? Thomas

    Read the article

  • how to delete contents from plist programmatically ?

    - by srikanth rongali
    I have a plist file. I want to delete the data from the plist. How can I do it programmatically ? My Plist have an array cells. cells is filled by dictionaries . Each dictionary is filled by string. I used the following way. NSString* plistPath1 = [[NSBundle mainBundle] pathForResource:@"details" ofType:@"plist"]; [cells removeObjectAtIndex:[clickedButtonPath row]]; NSMutableArray *array1 = [[NSMutableArray alloc] initWithCapacity:4]; array1 = cells; [array1 writeToFile:plistPath1 atomically: YES]; But the plist is not taking the changes. Thank you.

    Read the article

  • loading and formating the rtf file in uiwebview

    - by Jayshree
    Hello everybody. I am trying to load the contents of a rtf file in the uiwebview. I am successful in loading the contents, but it is unformatted. the fonts are too large and it doesnt have any format. it displays the color of the rtf content, but not the font or size. So what should i do now. is there anyother way to load the rtf and format it???? I load the rtf in following way: NSString *path = [[NSBundle mainBundle] pathForResource:@"Home" ofType:@"rtf"]; NSURL *url=[NSURL fileURLWithPath:path]; NSURLRequest *req=[NSURLRequest requestWithURL:url]; [menuWeb loadRequest:req]; So what should i do now. can anybody help me????

    Read the article

  • "Method definition not in @implementation context"?

    - by Nathan Hess
    I put this in X-code: - (void)viewDidLoad { [super viewDidLoad]; NSString *path = [[NSBundle mainBundle] pathForResource:@"DrinkArray" ofType:@"plist"]; NSMutableArray* tmpArray = [[NSMutableArray alloc] initWithContentsOfFile:path]; self.drinks = tmpArray; [tmpArray release]; // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem; } And it says this on the first line: "Method Definition not an @implementation context" Could anyone help?

    Read the article

  • [UITableViewController loadView] loaded the "PersonnalDetails" nib but didn't get a UITableView.

    - by tak
    I am trying to load a new view with the following code - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { PersonnelDetails *detailViewController = [[PersonnelDetails alloc] initWithNibName:@"PersonnelDetails" bundle:[NSBundle mainBundle]]; [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release]; } inhertance :- PersonnelDetails inherits UITableViewController but i am getting an exception : Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "PersonnalDetails" nib but didn't get a UITableView.' even though i have a UITableView in the PersonnalDetails nib and also i have connected the view outlet of PersonnelDetails(viewController) to the UITableView. what can be the posible cause?

    Read the article

  • How to add a view on cell.contentview of uitableview iphone sdk

    - by neha
    Hi all, In my application I'm creating a .xib of a class and loading that .xib on cells of uitableview of another class. I want to add this .xib to cell.contentView and not cell. How shall I do that? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString* cellIdentifier = @"testTableCell"; testTableCell * cell = (testTableCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"testTableCell" owner:self options:nil]; cell = tCell; } return cell; } testTableCell is my another class in which I have two labels and two buttons, of which I have created a .xib and loading it to tableview's cell as above. tCell is an object of class testTableCell. Thanks in advance.

    Read the article

  • use more then one sound in my iphone application using cocos2d

    - by Rana
    avc = [[MPAVController sharedInstance] avController]; //avc is AVController NSString *path = [[NSBundle mainBundle] pathForResource:@"Sound" ofType:@"wav"]; id feeder = [[MPArrayQueueFeeder alloc] initWithPaths:[NSArray arrayWithObject:path]]; [avc setQueueFeeder:feeder]; [avc play:nil]; [feeder release]; NSTimer *sound = [NSTimer scheduledTimerWithTimeInterval:(9.0) target:self selector:@selector(Gamesoundplay) userInfo:nil repeats:YES]; Hear i use tow framework for playing sound. 1. MediaPlayer.framework 2. AudioToolbox.framework I success to play the background sound with repeat after lodding the game. I also want to play sound after clicking some button action without stop the previous background sound.But when i click the other button that time background sound is stop and start again after time intereval ( 9.0 sec ) which i mention for repeated the sound time line. If anyone do this work then help me to complete my application.

    Read the article

  • Get CoreLocation Update before TableView population?

    - by Clemens
    hi, i have the corelocation stuff in an uitableview controller. i actually want to get a distance from two locations and print that distance in a tableview cell. the problem is, that the tableview is filled before all the corelocation stuff happens. how can i make corelocation makes all updates before the table is filled? heres my class: // // EntriesListViewController.m // OEAW_App // // Created by Clemens on 6/6/10. // Copyright 2010 MyCompanyName. All rights reserved. // import "EntriesListViewController.h" import "EntryDetailController.h" @implementation EntriesListViewController @synthesize locationManager; @synthesize delegate; NSMutableDictionary *entries; NSMutableDictionary *dictionary; CLLocation *coords; /- (id) init { self = [super init]; if (self != nil) { self.locationManager = [[[CLLocationManager alloc] init] autorelease]; self.locationManager.delegate = self; } return self; }/ (CLLocationManager *)locationManager { if (locationManager != nil) { return locationManager; } locationManager = [[CLLocationManager alloc] init]; locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; locationManager.delegate = self; return locationManager; } (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //coords.longitude = newLocation.coordinate.longitude; //coords.latitude = newLocation.coordinate.latitude; coords = newLocation; NSLog(@"Location: %@", [newLocation description]); } (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { NSLog(@"Error: %@", [error description]); } (void)viewDidLoad { //[[MyCLController alloc] init]; //[locationManager startUpdatingLocation]; [[self locationManager] startUpdatingLocation]; //---initialize the array--- //entries = [[NSMutableArray alloc] init]; //---add items--- //NSString *Path = [[NSBundle mainBundle] bundlePath]; //NSString *DataPath = [Path stringByAppendingPathComponent:@"Memorials.plist"]; dictionary = [[NSDictionary alloc] initWithContentsOfURL:[NSURL URLWithString: @"http://akm.madison.at/memorials.xml"]]; /*NSDictionary *dssItem = [dictionary objectForKey:@"1"]; NSString *text = [dssItem objectForKey:@"text"]; */ //entries = [[NSMutableDictionary alloc] init]; NSLog(@"%@", dictionary); //Path get the path to MyTestList.plist NSString *path=[[NSBundle mainBundle] pathForResource:@"Memorials" ofType:@"plist"]; //Next create the dictionary from the contents of the file. NSDictionary *dict=[NSDictionary dictionaryWithContentsOfFile:path]; //now we can use the items in the file. // self.name.text = [dict valueForKey:@"Name"] ; NSLog(@"%@",[dict valueForKey:@"Name"]); //---set the title--- self.navigationItem.title = @"Türkendenkmäler"; [super viewDidLoad]; } (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [dictionary count]; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell... NSArray *keys = [dictionary allKeys]; id key = [keys objectAtIndex:indexPath.row]; NSDictionary *tmp = [dictionary objectForKey:key]; NSString *name = [tmp objectForKey:@"name"]; cell.textLabel.text = name; cell.font = [UIFont fontWithName:@"Helvetica" size:12.0]; CLLocation *location = [[CLLocation alloc] initWithLatitude:[[tmp valueForKey:@"coords_x"] floatValue] longitude:[[tmp valueForKey:@"coords_y"] floatValue]]; /*CLLocation *newLoc = [[CLLocation alloc] initWithLatitude:coords.latitude longitude:coords.longitude];*/ //locationController = [[MyCLController alloc] init]; int distance = [coords distanceFromLocation:location]; NSLog(@"%@",distance); cell.detailTextLabel.text = [NSString stringWithFormat:@"%@m",distance]; //NSLog(@"%@", [getLocation newLoc]); return cell; } (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { EntryDetailController *detailViewController = [[EntryDetailController alloc] initWithNibName:@"EntryDetailController" bundle:nil]; //detailViewController.entrySelected = [dictionary objectAtIndex:indexPath.row]; NSArray *keys = [dictionary allKeys]; id key = [keys objectAtIndex:indexPath.row]; NSDictionary *tmp = [dictionary objectForKey:key]; NSString *name = [tmp objectForKey:@"name"]; detailViewController.entrySelected_name = name; NSString *location = [tmp objectForKey:@"location"]; detailViewController.entrySelected_location = location; NSString *type = [tmp objectForKey:@"type"]; detailViewController.entrySelected_type = type; NSString *slug = [tmp objectForKey:@"slug"]; detailViewController.entrySelected_slug = slug; [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release]; } (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } (void)dealloc { [entries release]; [super dealloc]; } @end

    Read the article

  • Crashes when using AVAudioPlayer on iPhone

    - by mindthief
    Hi all, I am trying to use AVAudioPlayer to play some sounds in quick succession. When I invoke the sound-playing function less frequently so that the sounds play fully before the function is invoked again, the application runs fine. But if I invoke the function quickly in rapid succession (so that sounds are played while the previous sounds are still being played), the app eventually crashes after ~20 calls to the function, with the message "EXC_BAD_ACCESS". Here is code from the function: NSString *nsWavPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:wavFileName]; AVAudioPlayer* theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:nsWavPath] error:NULL]; theAudio.delegate = self; [theAudio play]; As mentioned in another thread, I implemented the following delegate function: - (void) audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag { if(!flag) NSLog(@"audio did NOT finish successfully\n"); [player release]; } But the app still crashes after around ~20 rapid calls to the function. Any idea what I'm doing wrong?

    Read the article

  • How to navigate clicking row to another UITableView ?

    - by Meko
    Hi. I am trying to show detailed UItable view when clicking on row. I used - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; photoListViewController = [[PhotoListViewController alloc]initWithNibName:@"PhotoListViewController" bundle:[NSBundle mainBundle]]; [self.navigationController pushViewController:photoListViewController animated:YES]; [photoListViewController release]; // [self.navigationController pushViewController:anotherViewController]; // [anotherViewController release]; } This PhotoListViewController is an empty UITableViewController. As I know UITableViewCOntroller has a navigation controller implemented and I don`t have to create navigation controller. But When I clicked on row it does not navigate to second view.AM I have to make some connection on nib file?I only created this PhotoListViewController in File-New-UIViewCOntroller and selected UITableView. EDIT : SOLVED I solved my problem.I should use UINAvigation object.I thought that UITable has it but there was no ))

    Read the article

  • Why my own UIViewController can't detect touch?

    - by Tattat
    I have my OwnViewController, the viewDidLoad is like this: - (void)viewDidLoad { [super viewDidLoad]; UIImage *img = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"myImg" ofType:@"png"]]; CGRect cropRect = CGRectMake(175, 0, 175, 175); CGImageRef imageRef = CGImageCreateWithImageInRect([img CGImage], cropRect); UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 175, 175)]; imageView.image = [UIImage imageWithCGImage:imageRef]; self.view = imageView; CGImageRelease(imageRef); } It works, and I have detect touches method like this: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"touchesBegan"); } But my UIView can't detect any touches. My Own UIViewController is a subclass of UIViewController. It is a little square view on the IB, why that can't detect touches? thx u.

    Read the article

  • code to play sound programmatically using a button on the iphone

    - by Brandon
    I am trying to figure out how to hook up a button to play a sound programmatically without using IB. I have the code to play the sound, but have no way of hooking the button up to play the sound? any help? here is my code that I'm using: - (void)playSound { NSString *path = [[NSBundle mainBundle] pathForResource:@"boing_1" ofType:@"wav"]; AVAudioPlayer* myAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path error:NULL]]; myAudio.delegate = self; myAudio.volume = 2.0; myAudio.numberOfLoops = 1; [myAudio play]; }

    Read the article

  • to print local xml file through NSData?

    - by senthilmuthu
    hi, i want to take some xml data from local path,and to parse,but when i use following code NSLog returns(content) different texts which is differed from xml file, how can i get exact xml data to check ,it consists correct xml data or not? any help please? when i parse , it returns nothing..i have saved the file as .xml and copied to local resource folder? NSString *xmlFilePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"samp.xml"]; NSString *xmlFileContents = [NSString stringWithContentsOfFile:xmlFilePath]; NSData *data = [NSData dataWithBytes:[xmlFileContents UTF8String] length:[xmlFileContents lengthOfBytesUsingEncoding: NSUTF8StringEncoding]]; NSString *content=[[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding]; NSLog(@"%@",content);

    Read the article

  • Rotate image in Quartz? Image is upside down! (iPhone)

    - by Johannes Jensen
    I don't want to transform the ENTIRE context. I'm making a game with Quartz, and I'm drawing my player with lines, rects and ellipses. And then I have diamong.png which I rendered at 0,0 in the top left of the screen. Problem is... It renders upside down! How would I rotate it 180 degrees? Here's some of my code: CGImageRef diamondImage = CGImageRetain([UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"Diamond.png" ofType:nil]].CGImage); CGContextDrawImage(context, CGRectMake(0, 0, 32, 24), diamondImage); If it's of any help, I'm using Landscape mode, with home button to the right. It's defined both in my .plist, and in my ViewController's -shouldAutorotateToInterfaceOrientation:interfaceOrientation: How would I rotate/transform it?

    Read the article

  • How to load xib file with attached view controller ?

    - by hib
    Hello all , I am using a xib file as a back view in coverflow component . and it is seeing nicely . The code for loading a xib file is : NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"TestMine" owner:nil options:nil]; backView = [array objectAtIndex:0]; Now I want to attach a view controller with this xib without changing the current code . How can I do so ? Tell me if more details need to answer the question . Thanks .

    Read the article

  • UIAlertView with subview animating to new view crashes app

    - by William
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Congratulations" message:message delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"View", nil]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(110, 100, 80, 80)]; NSString *imagePath = [NSString stringWithFormat:@"%@", [Array objectAtIndex:x]]; UIImage *bkgImg = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:imagePath ofType:@"png"]]; imageView.image = bkgImg; [bkgImg release]; [alert addSubview:imageView]; [imageView release]; [alert show]; [alert release]; That is the code that I am using to create the alert view. Currently, I have it set up so if the user presses one of the buttons, it will load up a new viewcontroller. It worked fine until I added a subview to the UIAlertView. Now, whenever it animates to the new screen, it just crashes the program. I am fairly new to iPhone development and any help would be appreciated.

    Read the article

  • "Cannot find executable for CFBundle/CFPlugIn" error

    - by Emil
    Cannot find executable for CFBundle/CFPlugIn 0x432bfa0 </Library/Audio/Plug-Ins/HAL/DVCPROHDAudio.plugin> (not loaded) Cannot find function pointer NewPlugIn for factory C5A4CE5B-0BB8-11D8-9D75-0003939615B6 in CFBundle/CFPlugIn 0x432bfa0 </Library/Audio/Plug-Ins/HAL/DVCPROHDAudio.plugin> (not loaded) That's the error I get when I try to run this code: NSString *path = [[NSBundle mainBundle] pathForResource:[arraySubFarts objectAtIndex:indexPath.row] ofType:@"mp3"]; NSURL *file = [[NSURL alloc] initFileURLWithPath:path]; AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:file error:nil]; self.player = player; [player prepareToPlay]; [player setDelegate:self]; [self.player play]; Any idea why? :S I have included the needed frameworks, and the code works great, the only thing is this odd Console-message..

    Read the article

  • PList Chicken/Egg Scenario

    - by David van Dugteren
    Hi, I want to read/write to cache.plist If I want to read an existing premade plist file stored in the resources folder I can go: path = [[NSBundle mainBundle] bundlePath]; NSString *finalPath = [path stringByAppendingPathWithComponent@"cache.plist"]; NSMutableDictionary *root = ... But then I wish to read it from the iPhone. Can't, the Resources folder is only readable. So I need to use: NSDocumentDirectory, NSUserDomain,YES So how can I have my plist file preinstalled to the Document Directory location? Thus meaning I don't have to mess around with untidy code copying the plist file over at startup. (Unless that's the only way).

    Read the article

  • Cocoa touch SDK 3.2 - How to play video

    - by teepusink
    Hi, How do I play video on SDK 3.2 (iPad)? Read many questions here but they talked mostly for iPhone. For example, the MoviePlayer example here http://developer.apple.com/iphone/library/samplecode/MoviePlayer_iPhone/Introduction/Intro.html That works on 3.1.3 but when I run it on 3.2, it doesn't work. So basically I'm able to play a video on 3.1.3 using this code but the same code won't run on 3.2 NSString *moviePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Movie.mp4"]; MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]]; moviePlayer.movieControlMode = MPMovieControlModeDefault; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; [moviePlayer play]; Thanks, Tee

    Read the article

  • UIButton that cycles through images when clicked

    - by dot
    I have three images that I want to cycle through when clicking on a UIButton. How would I go about doing this? This is what I have so far, but it's not really working. //the images NSString* imageNames[] = {"MyFirstImage", "AnotherImage", whatever else}; int currentImageIndex = 0; and - (IBAction)change{ UIImage* imageToShow = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource: imageNames[currentImageIndex] ofType:@"png"]; if( currentImageIndex++ == sizeof(imageNames)/sizeof(NSString)) //check to see if you hit the last image { currentImageIndex = 0; //start over } } Ideas? Any help will be greatly appreciated! Thanks!

    Read the article

  • Background image of table cell

    - by Shuaib
    Hey guys, Trying to set a background image for a table view cell, tried almost everything but failing. Hoping someone would notice what I am doing wrong. Here is how my current code looks like: static NSString *CustomCellIdentifier = @"listCustomCell"; listCustomCell *cell = (listCustomCell *)[tableView dequeueReusableCellWithIdentifier: CustomCellIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"listCustomCell" owner:self options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[listCustomCell class]]) cell = (listCustomCell *)oneObject; } cell.backgroundColor = [UIColor clearColor]; UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"list_selected.png"]]; //[cell setBackgroundView:backgroundImageView]; cell.backgroundView = backgroundImageView; The image won't show up in the background of the cell. All I see is plain white background. Thanks for help.

    Read the article

  • connect tableView + tableView

    - by totato
    Right now I have an indexed tableview that goes to a detail view but i want it to go to another tableview then a detail view. my code like this: ` - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { displyAnnController *anController = [[displyAnnController alloc] initWithNibName:@"AnnView" bundle:[NSBundle mainBundle]]; DetailViewController *dvController = [[DetailViewController alloc] initWithStyle:UITableViewStyleGrouped]; switch (indexPath.row) { case 0: [self.navigationController pushViewController:anController animated:YES]; [anController release]; anController = nil; break; case 1: [self.navigationController pushViewController:dvController animated:YES]; [dvController release]; dvController = nil; break; default: break; }` and when I press the cell with index 0 in the simulator, the program is crash! what's the problem? pleas help me ..

    Read the article

  • Who should call viewDidLoad on progammatically loaded views?

    - by Remus Rusanu
    When I need to load a view programatically I do the following: MyController* myController = [[MyController alloc] init]; [[NSBundle mainBundle] loadNibNamed:@"myNib" owner:myController options:nil]; // use my controller here, eg. push it in the nav controller This works fine, but my controller's viewDidLoad is never called. So I resorted to manually calling it after the loadNibNamed call, but it doesn't seem correct. I was expecting the framework to call the viewDidLoad on my behalf. Is this the right way or I'm missing something?

    Read the article

  • Line breaks in "NSString"s returned from PList don't work.

    - by Moshe
    I've seen this post: http://stackoverflow.com/questions/2035567/nsstring-newline-escape-in-plist but I'd like to know if there's a way to pragmatically render \n line breaks. I'm currently using: decisionText.text = [NSString stringWithFormat: (@"%@", [replies objectAtIndex:(arc4random() % [replies count])])]; Which randomly grabs a String from the replies array. The array was loaded from a plist like so: replies = [[NSMutableArray alloc] initWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"AdviceList" ofType:@"plist"]]; What am I missing? The answer can't be to manually enter line breaks. That's not programming! (Sounds like word processing to me.)

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >