Search Results

Search found 560 results on 23 pages for 'nsdictionary'.

Page 14/23 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Passing Data thru NSTimer UserInfo

    - by zorro2b
    I a trying to pass data thru userInfo for an NSTimer call. What is the best way to do this? I am trying to use an NSDictionary, this is simple enough when I have objective c objects, but what about other data? I want to do something like this, which doesn't work as is: - (void) play:(SystemSoundID)sound target:(id)target callbackSelector:(SEL)selector { NSLog(@"pause ipod"); [iPodController pause]; theSound = sound; NSMutableDictionary *cb = [[NSMutableDictionary alloc] init]; [cb setObject:(id)&sound forKey:@"sound"]; [cb setObject:target forKey:@"target"]; [cb setObject:(id)&selector forKey:@"selector"]; [NSTimer scheduledTimerWithTimeInterval:0 target:self selector: @selector(notifyPause1:) userInfo:(id)cb repeats:NO]; }

    Read the article

  • Convert XML to .plist

    - by Dror Sabbag
    Hey, I have an XML exported from Oracle DB, which will be downloaded into my application main bundle. i would like to convert this XML file into .plist file so i can assign the values into NSDictionary and NSArrays.. Is there a way to get this to work? or is there a better way to work with an external XML file? note that one of the fields in the XML is a full HTML content example: <main> <DATA_RECORD> <ID>ID1</ID> <NO>1234512</NO> <TYPE>NEW</TYPE> <TYPE_NO>0</TYPE_NO> <TEXT_ID>TEXT1</TEXT_ID> <TEXT><HTML>some html goes here</HTML></TEXT> </DATA_RECORD> </main>

    Read the article

  • What is the correct way to add a subview to a new window, making it aware of its available window si

    - by favo
    Hi, This is some kind of a basic question: I am adding a new Subview to a window using: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { viewController = [[myViewController alloc] initWithNibName:@"myNib" bundle:nil]; [window addSubview:viewController.view]; This displays the view at 100% on the window, having the Clock overlaying some pixels of that view on top. Rotating makes the view aware of the clock and resizes it to begin correctly below the clock without any overlay. What is the correct way to add a subview to a new window, making it aware of its available window size?

    Read the article

  • Connecting ipad to external monitor

    - by Josh P.
    I am trying to connect my ipad app to an external screen using the following (not checking the correct resolution for no - just want it up and running). - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [window addSubview:[navigationController view]]; if ([[UIScreen screens] count] > 1) { window.screen = [[UIScreen screens] objectAtIndex:1]; } [window makeKeyAndVisible]; return YES; } Is this supposed to redirect everything to the external monitor? How dows it work with touches/gestures? I see in the Apple apps, the controls etc are left on the ipad screen...

    Read the article

  • Update query in sqlite3 problem

    - by user271753
    [sqlite executeQuery:@"UPDATE UserAccess SET Answer ='Positano';"]; NSArray *query2 = [sqlite executeQuery:@"SELECT Answer FROM UserAccess;"]; NSDictionary *dict = [query2 objectAtIndex:0]; NSString *itemValue = [dict objectForKey:@"Answer"]; NSLog(@"%@",itemValue); It does print Positano at this point .. But when I just print without the update query again . I get the old entry which is Paris. What am I doing wrong ??? I am using http://th30z.netsons.org/2008/11/objective-c-sqlite-wrapper/ wrapper. Regards , Novice

    Read the article

  • Sorting NSTableColumn contents

    - by Yahoo
    Hey, I have a problem with sorting NSTableColumn contents. In my NSTableView there are three columns: File, Size, Path. The contents are stored in NSMutableArray. Each object in this array is a NSDictionary containing three keys: file, size and path - value for each is a NSString. In Interface Builder, in each Table Column's attributes I can choose sorting options: Selector: IB entered "compare:" which I think is ok, because I compare NSStrings. Sort Key - and that's the problem I think - I don't know what to enter here. Any clues? If you've got questions about my code, please ask.

    Read the article

  • How to call another class's method from my app delegate

    - by Jared
    I have an application that utilizes UILocalNotifications to pop-up UIAlertViews. When the notification fires, the user chooses to go into the app, and this method is called from my app delegate: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {...} Where I can handle it and where I also prompt another alertview for more information. So when the app launches, it is displaying view A, and then the alertview pops up and prompts for input. This alertview, however, is originating from my app delegate. I need to be able to reload view A when the user hits Yes/No on the alertview. How can I do that from within my app delegate? Any help is appreciated!!

    Read the article

  • Xcode iphone sdk - Searching in UITableView, different pattern matching

    - by Lorenzo
    Hi everyone, I'm coding a UITableView with a UISearchBar to search between a list of cities (loaded in the uitableview) Here is my code for searhing: - (void) searchTableView { NSString *searchText = searchBar.text; NSMutableArray *searchArray = [[NSMutableArray alloc] init]; for (NSDictionary *dictionary in listOfItems) { NSArray *array = [dictionary objectForKey:@"Cities"]; [searchArray addObjectsFromArray:array]; } for (NSString *sTemp in searchArray) { NSRange titleResultsRange = [sTemp rangeOfString:searchText options:NSCaseInsensitiveSearch]; if (titleResultsRange.length > 0) [copyListOfItems addObject:sTemp]; } [searchArray release]; searchArray = nil;} And with this everything works fine, but i need to do something a bit different. I need to search only between items that match pattern Word* and not * Word *. For example if I search "roma", this need to match just with "Roma" or "Romania" and not with "Castelli di Roma". Is that possible with this searchbar? How can i modify this? Thanks

    Read the article

  • Sorting Objects in NSArray

    - by Sam Budda
    I have an NSArray with 3 objects in it. Each object is made up of 5 values. How can I sort by Date with in the objects? result: ( gg, "2012-10-28 01:34:00 +0000", "Church Bells", "pin_red", 1 )( iu, "2008-09-22 17:32:00 +0000", "Birthday Song", "pin_red", 1 )( "my birthday woo hoo", "2012-09-04 19:27:00 +0000", "Birthday Song", "pin_blue", 1 ) The results I am looking for - Sorted Array should look like this. ( iu, "2008-09-22 17:32:00 +0000", "Birthday Song", "pin_red", 1 ) ( "my birthday woo hoo", "2012-09-04 19:27:00 +0000", "Birthday Song", "pin_blue", 1 ) ( gg, "2012-10-28 01:34:00 +0000", "Church Bells", "pin_red", 1 ) I am getting this array from my nsdictionary object. dictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:stringsPlistPath]; stringsMutableArray = [[NSMutableArray alloc] initWithObjects:nil]; for (id key in dictionary) { [stringsMutableArray addObject:[dictionary objectForKey:key]]; }

    Read the article

  • iPhone WebApp Question

    - by Henry D'Andrea
    I have this code- /** Save the web view as a screenshot. Currently only supports saving to the photo library. / - (void)saveScreenshot:(NSArray)arguments withDict:(NSDictionary*)options { CGRect screenRect = [[UIScreen mainScreen] bounds]; CGRect imageRect = CGRectMake(0, 0, CGRectGetWidth(screenRect), CGRectGetHeight(screenRect)); UIGraphicsBeginImageContext(imageRect.size); [webView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(viewImage, self, nil, nil); UIAlertView *alert= [[UIAlertView alloc] initWithTitle:nil message:@"Image Saved" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } This is for saving whatever you drew in my app. How would I add the button for this in the HTML code. How do i call from it?

    Read the article

  • How to show login screen only for the first time when app launches

    - by Jaw Ali
    I want to launch the login screen when first time app launches other wise app work simple but problem is that again again it goes to login screen. here is the code which i am using in didFininsh I want the user show go to login screen first time only and next time it should show splitViewController [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES],@"firstLaunch",nil]]; if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) { [self.window addSubview:[splitViewController view]]; LoginViewController *targetController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil]; targetController.modalPresentationStyle = UIModalPresentationFullScreen; [self.splitViewController presentViewController:targetController animated:YES completion:nil]; } else { [self.window addSubview:[splitViewController view]]; } // my comment[window addSubview:splitViewController.view]; [window makeKeyAndVisible]; return YES;

    Read the article

  • How do I make a UIAlertView happen only on the first start-up of an iPhone app?

    - by user309245
    I'm using the UIAlertView to make a pop-up happen once the app has started up. It works fine but I only want the pop up to happen on the first start-up of the app. At the moment I've got the UIAlertView in the AppDelegate class, after the application didFinishLaunching. Here is my code at the moment. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { sleep(4); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome!" message:@"SAMPLE!!!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; I'm new to app development so sorry if this is simple. Thanks in advance! :)

    Read the article

  • Trouble setting FIrst view controller which will appear on App Startup

    - by Matte.Car
    I'm setting setting FIrst view controller which will appear on my App Startup. It should appear an UIView first time as a tutorial and, from second time, another standard view. In AppDelegate I wrote this: #import "AppDelegate.h" #import "TabBarController.h" #import "TutorialController.h" @implementation AppDelegate TabBarController * viewControllerStandard; // standard view TutorialController * viewControllerFirst; // tutorial view @synthesize window; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if ([@"1" isEqualToString:[[NSUserDefaults standardUserDefaults] objectForKey:@"Startup"]]) { window.rootViewController = viewControllerStandard; } else { window.rootViewController = viewControllerFirst; } [window makeKeyAndVisible]; return YES; } It doesn't return any alert but, launching app, after splashscreen, it appear only a black screen. Without that codes everything works fine. What could be wrong? Thank you!

    Read the article

  • Object pointer value as key into dictionary

    - by Ranking Stackingblocks
    I want to use the object's reference value as a key into a dictionary, as opposed to a copy of value of the object. So, I essentially want to store an object associated with a particular instance of another object in a dictionary and retrieve that value later. Is this possible? Is it completely against the idea of NSDictionary? I can tell that I am probably approaching this the wrong way because the dictionary wants me to implement NSCopying on the object itself, which doesn't really make sense in terms of what I'm doing. I can see that what I should really be doing is wrapping the pointer value, but that seems a little mad. Advice would be appreciated.

    Read the article

  • Limit to 10 number of annotations in mapkit!

    - by teddafan
    Hi, I have all my annotations(as nsdictionnaries) in an array , and the users add them one by one by tapping on an icon. I want to make it impossible after adding 10 annotations (there is 110). Is it here i have to make something?: -(IBAction) plusButtonTapped: (id) sender { NSDictionary *poiDict = [poiArray objectAtIndex:nextPoiIndex++]; CLLocationCoordinate2D poiCoordinate; poiCoordinate.latitude = [[poiDict valueForKey:@"workingCoordinate.latitude"] doubleValue]; poiCoordinate.longitude = [[poiDict valueForKey:@"workingCoordinate.longitude"] doubleValue]; MyMapAnnotation *poiAnnotation = [[MyMapAnnotation alloc] initWithCoordinate:poiCoordinate title:[poiDict valueForKey:@"Subtitle"] color:MKPinAnnotationColorRed ]; [mapView addAnnotation:poiAnnotation]; [self adjustMapZoom]; } Thank you for your help in advance, teddafan

    Read the article

  • iPhone SDK - How to display a photo taken with the camera inside a UINavigationController?

    - by dan
    This is my code so far: /* class: myViewController @interface myViewController: UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate> */ - (IBAction) getPicture { UIImagePickerController * picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypeCamera; [self presentModalViewController:picker animated:YES]; } - (void) imagePickerController:(UIImagePickerController *)thePicker didFinishPickingMediaWithInfo:(NSDictionary *)imageInfo { [[thePicker parentViewController] dismissModalViewControllerAnimated:YES]; UIImage *img = [imageInfo objectForKey:@"UIImagePickerControllerOriginalImage"]; self.myImageView.image = img; } So basically I'm trying to get a photo from the iPhone camera and display it in a UIImageView. This works perfectly fine as long the class myViewController is displayed as a standalone view. If I'm putting the View inside a UINavigationController the UIImageView won't display the image after taking one with the camera. But if I choose a picture from the library everything is fine again. So why does the UIImageView won't display a image taken with the camera inside a UINavigationController?

    Read the article

  • Why Can't I import a UITableViewCell subclass ? That's weird....

    - by user320064
    It's like this, I created a UITableViewCell subclass called NewsItemCell, then I wanna use it in my FirstViewController.m, then I tried to import it, but the compiler keeps telling me this Below is my code, it is driving me mad, thank you if you can help. import "NewsItemCell.h" import "FirstViewController.h" @implementation FirstViewController @synthesize computers; (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"NewsItemCellIdentifier"; NewsItemcell *cell = (NewsItemcell *)[tableView dequeueReusableCellWithIdentifier: CellIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"NewsItemCell" owner:self options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[NewsItemcell class]]) cell = (NewsItemcell *)oneObject; } NSUInteger row = [indexPath row]; NSDictionary *rowData = [self.computers objectAtIndex:row]; cell.newsTitle.text = [rowData objectForKey:@"Color"]; cell.newsDate.text = [rowData objectForKey:@"Name"]; return cell; } Jason

    Read the article

  • iPhone, how to dyanmic create new entity (table) via core data model?

    - by Robin
    as topic, I just want create new Entity(table) in sqlite , my code as follows: +(BOOL)CreateDataSet:(NSManagedObjectModel *) model attributes:(NSDictionary*)attributes entityName:(NSString*) entityName { NSEntityDescription *entityDef = [[NSEntityDescription alloc] init]; [entityDef setName:entityName]; [entityDef setManagedObjectClassName:entityName]; [model setEntities:[NSArray arrayWithObject:entityDef]]; //@step NSArray *properties = [CoreDataHelper CreateAttributes:attributes]; [entityDef setProperties:properties]; [entityDef release]; return TRUE; } but it throw errors: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Can't modify an immutable model.' * Call stack at first throw: ( 0 CoreFoundation 0x01c5abe9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x01daf5c2 objc_exception_throw + 47 2 CoreData 0x0152634a -[NSManagedObjectModel(_NSInternalMethods) _throwIfNotEditable] + 106 3 CoreData 0x01526904 -[NSManagedObjectModel setEntities:] + 36 .... that seem show the model is read only..... anyone can help on this problem? thanks

    Read the article

  • How to manage orientation in iPad app

    - by Annie
    I have added a image on navigationcontroller in appdelagte class. and set yes in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { loginViewController = [[LoginViewController alloc]initWithNibName:@"LoginViewController" bundle:nil]; [self.window addSubview:_navController.view]; _navController.navigationBarHidden = NO; navimage = [[UIImageView alloc] init]; navimage.frame = CGRectMake(300, 18, 177, 47); navimage.image = [UIImage imageNamed: @"logo.png"]; [_navController.view addSubview:navimage]; [self.window makeKeyAndVisible]; return YES; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ return YES; } But navigation image position is not changing. The frame remains same in both modes. Please give me idea how it will be solved in the case of navigation controller image.

    Read the article

  • image is not getting loaded in view.

    - by anurag
    I have created 2 views named "FirstView" and "SecondView".SecondView's nib file has an UIImage view object as its IBOtlet.Now I am getting an UIImage object from some FirstViewController's method.Now I am setting the SecondViewController's imageView property with that image and then I am pushing my SecondView Controller's object in Navigation Controller.The SecondView gets loaded but that image is not shown in that view. The code is as follows:..... - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo { [[picker parentViewController] dismissModalViewControllerAnimated:YES]; SecondViewController *secondView=[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:[NSBundle mainBundle]]; secondView.imageView.image=img; [self.navigationController pushViewController:secondView animated:YES]; }

    Read the article

  • image is not getting loaded in view.

    - by anurag
    I have created 2 views named "FirstView" and "SecondView".SecondView's nib file has an UIImage view object as its IBOtlet.Now I am getting an UIImage object from some FirstViewController's method.Now I am setting the SecondViewController's imageView property with that image and then I am pushing my SecondView Controller's object in Navigation Controller.The SecondView gets loaded but that image is not shown in that view. The code is as follows:..... (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo { [[picker parentViewController] dismissModalViewControllerAnimated:YES]; SecondViewController *secondView=[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:[NSBundle mainBundle]]; secondView.imageView.image=img; [self.navigationController pushViewController:secondView animated:YES]; }

    Read the article

  • How to programaticly access min and Max values defined in a core-data model designed with XCode ?

    - by Xav
    I was expecting to find that in the NSAttributeDescription class, but only the default value is there. Behind the scene I tought a validationPredicate was created but trying to reach it using NSDictionary* dico= [[myManagedObject entity] propertiesByName]; NSAttributeDescription* attributeDescription=[dico objectForKey:attributeKey]; for (NSString* string in [attributeDescription validationWarnings]) just get me nowhere, no validationWarnings, no validationPredicates... any thoughts on this ? Edit1: It seems that getting the entity straight from the managedObject doesn't give you the full picture. Getting the Entity from the NSManagedObjectModel permits to reach the validationWarnings & validationPredicates...

    Read the article

  • UIImageWriteToSavedPhotosAlbum working... sometimes.

    - by MegaEduX
    Hello, UIImageWriteToSavedPhotosAlbum is only working sometimes. Sometimes it works, sometimes it doesn't, exact same function. - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo { NSLog(@"Saving image to camera roll..."); UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil); NSLog(@"Done!"); } I am using a UIImagePicker controller to get the image that then calls that function. Sometimes it saves it to the camera roll, other times it simply doesn't. Anyone has any idea? Thanks in advance.

    Read the article

  • NavigationBar text colour not changing?

    - by Jeff
    In my tabbar application I am adding Navigation controller in each tab. Suppose the selected index is 0 when I opening the app.In my 3rd tab(selected index=2) I want to change the text colour of navigationbar title.And I am using the code [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor greenColor],UITextAttributeTextColor,nil]]; But its not changing the text color of Index 0 and 2.Colour of index 1 will change only if that tab was not clicked before changing the colour by using the above code. I don't know whats is the issue ? Any help/code will be appreciable.

    Read the article

  • Sorting NSTableColumn contents

    - by Yahoo
    Hey, I have a problem with sorting NSTableColumn contents. In my NSTableView there are three columns: File, Size, Path. The contents are stored in NSMutableArray. Each object in this array is a NSDictionary containing three keys: file, size and path - value for each is a NSString. In Interface Builder, in each Table Column's attributes I can choose sorting options: Selector: IB entered "compare:" which I think is ok, because I compare NSStrings. Sort Key - and that's the problem I think - I don't know what to enter here. Any clues? If you've got questions about my code, please ask.

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >