Search Results

Search found 3457 results on 139 pages for 'cocoa'.

Page 19/139 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Core Data fetch request with array

    - by JK
    I am trying to set a fetch request with a predicate to obtain records in the store whose identifiers attribute match an array of identifiers specified in the predicate e.g. NSString *predicateString = [NSString stringWithFormat:@"identifier IN %@", employeeIDsArray]; The employeeIDsArray contains a number of NSNumber objects that match IDs in the store. However, I get an error "Unable to parse the format string". This type of predicate works if it is used for filtering an array, but as mentioned, fails for a core data fetch. How should I set the predicate please?

    Read the article

  • How to get a long url from a short url

    - by JK
    I would like to determine what the long url of a short url is. I have tried using http HEAD requests, but very few of the returned header fields actually contain any data pertaining to the destination/long url. Is there: 1. Any way to determine the long url? 2. If so, can it be done without downloading the body of the destination? Thank you

    Read the article

  • Adding methods to an Objective C class interface is optional?

    - by Steve the Plant
    Coming from a C++ background, one thing that confuses me about Objective C is the fact that you can add a method to a class without actually specifying it in the class interface. So I had a barrage of questions: Why would someone choose to not add the method in the class interface? Is it simply because of visibility? Methods without a declaration in the interface are private? Is declaring methods in a class interface just optional? Is it different for overriding a base class' method?

    Read the article

  • NSOutlineView not redrawing

    - by Septih
    Hello, I have an NSOutlineView with checkboxes. I have the checkbox state bound to a node item with the key shouldBeCopied. In the node item I have the getters and setters like so: -(BOOL)shouldBeCopied { if([[self parent] shouldBeCopied]) return YES; return shouldBeCopied; } -(void)setShouldBeCopied:(BOOL)value { shouldBeCopied = value; if(value && [[self children] count] > 0) [[self delegate] reloadData]; } The idea here is that if the parent is checked, so should the children. The problem I'm having is that when I check the parent, it does not update that view of the children if they are already expanded. I can understand that it should not be updated by the bindings because i'm not actually changing the value. But should reloadData not cause the bindings to re-get the value, thus calling -shouldBeCopied for the children? I have tried a few other things such as -setNeedsDisplay and -reloadItem:nil reloadChildren:YES but none work. I've noticed that the display gets refreshed when I swap to xcode and then back again and that's all I want, so how do I get it to behave that way?

    Read the article

  • How to use NSScanner?

    - by Zopi
    Hi, I've just read Apple's docu of NSScanner. I'm trying to get the integer of that string: @"user logged (3 attempts)". I can't find any example, how to scan within parentheses. Any ideas? Here's the code: NSString *logString = @"user logged (3 attempts)"; NSScanner *aScanner = [NSScanner scannerWithString:logString]; [aScanner scanInteger:anInteger]; NSLog(@"Attempts: %i", anInteger); Regrads, Ruby

    Read the article

  • Why are the default UI controls in my iPhone app blurred?

    - by Tom H
    Why would the default iPhone interface elements, specifically the UISwitch (unmodified) and a UISegmentedControl appear slightly blurred? I have not changed them or called any private APIs. This blurring occurs when I run it both in the simulator and when I load it on my iPod Touch, so I don't think it's a one off drawing glitch. These elements were created via some code (initWithFrame:) not in interface builder. Here is a screenshot of the blurring in the simulator: http://drp.ly/14rS6a It looks similar on the actual device. Thanks for your help

    Read the article

  • Checking an empty Core Data relationship (SQLite)

    - by rwat
    I have a to-many relationship in my data model, and I'd like to get all the objects that have no corresponding objects in the relationship. For example: Customer - Purchases I want to get all Customers that have 0 Purchases. I've read somewhere that I could use "Purchases[SIZE] = 0", but this gives me an unsupported function expression error, which I think means it doesn't work with a SQLite backing store (which I don't want to switch from, due to some performance constraints). Any ideas?

    Read the article

  • How to view existing data in Core Data?

    - by mshsayem
    Well, may be this question is silly, but I couldn't find a way (except programmatically). I built a project (for iPhone OS 3.0) which uses Core Data. The xcdatamodel file shows the schema description, but I want to see the data in tabular form (like the management studio for mssql server or phpmyadmin for mysql). Is there any way (except coding)? What is that? Also, which file (in disk/device) those data are stored into? [ I built the tutorial (from apple) on Core Data, named Locations. They used this line somewhere in the code: NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"Locations.sqlite"]]; But, I did not see any "xxxxx.sqlite" file in project location (nor in the disk).]

    Read the article

  • Best practise - Accessing preferences globally

    - by JK
    User preferences for my app is store in NSUserDefaults. This includes a "theme" preference, which needs to be accessed frequently by multiple classes. I would prefer not to call "[[NSUserDefaults standardUserDefaults] objectForKey:..." repeatedly as it makes for inconcise code and I assume will incur overhead. What is the preferred and most concise method for accessing preferences in any class?

    Read the article

  • Calling NSFetchedResultsController & CoreData experts

    - by JK
    I am having a few nagging issues with NSFetchedResultsController and CoreData, any of which I would be very grateful to get help on. Issue 1 - Updates: I update my store on a background thread which results in certain rows being delete, inserted or updated. The changes are merged into the context on the main thread using the "mergeChangesFromContextDidSaveNotification:" method. Inserts and deletes are updated properly, but updates are not (e.g. the cell label is not updated with the change) although I have confirmed the updates to come through the contextDidSaveNotifcation, exactly like the inserts and deleted. My current workaround is to temporarily change the staleness interval of the context to 0, but this does not seem like the ideal solution. Issue 2 - Deleting objects: My fetch batch size is 20. If an object is deleted by the background thread which is in the first 20 rows, everything works fine. But if the object is after the first 20 rows and the table is scrolled down, a "CoreData could not fulfill a fault" error is raised. I have tried resaving the context and reperforming the frc fetch - all to no avail. Note: In this scenario, the frc delegate method "didChangeObject...." is not called for the delete - I assume this is because the object in question had not been faulted at that time (as it is was outside the initial fetch range). But for some reason, the context still thinks the object is around, although is has been deleted from the store. Issue 3 - Deleting sections : When the deletion of a row leads to the deletion of a section, I have gotten the "invalid number of rows in section???" error. I have worked around this by removing the "reloadSection" line from the NSFetchedResultsChangeMove: section and replacing it with "[tableView insertRowsAtIndexPaths...." This seems to work, but once again, I am not sure if this is the best solution. Any help would be greatly appreciated. Thank you!

    Read the article

  • UTC-8 conversion

    - by leachianus
    Hey guys, I am grabbing a JSON array and storing it in a NSArray, however it includes JSON encoded UTF-8 strings, for example pass\u00e9 represents passé. I need a way of converting all of these different types of strings into the actual character. I have an entire NSArray to convert. Or I can convert it when it is being displayed, which ever is easiest. I found this chart http://tntluoma.com/sidebars/codes/ is there a convenience method for this or a library I can download? thanks, BTW, there is no way I can find to change the server so I can only fix it on my end...

    Read the article

  • novice needing help on shuffeling an array

    - by steffen Myklebust
    Please help a TOTAL beginner.! I found this post: http://stackoverflow.com/questions/56648/whats-the-best-way-to-shuffle-an-nsmutablearray And as i try to deploy this in my own code, I cant get it working... :-( Can anyone help me to resolve this code? To me it looks like the shuffle function is not called..? here is my code: // // shuffle2ViewController.h // shuffle2 #import @interface shuffle2ViewController : UIViewController { NSMutableArray *puzzles; int *randomSort; } - (void)shuffle; @end //============================= // shuffle2ViewController.m ´#import "shuffle2ViewController.h" @implementation shuffle2ViewController (void)viewDidLoad { [super viewDidLoad]; NSMutableArray *puzzles = [NSMutableArray arrayWithObjects:@"1",@"2",@"3", @"4",@"5",@"6",@"7",@"8",@"9", @"10",@"11",@"12", nil]; // Call the shuffle function [self shuffle]; // print to log int i; NSLog(@"NEW OLD"); NSLog(@"================="); for (i = 0; i < 12; ++i) NSLog(@" %2i %@", i + 1, [puzzles objectAtIndex:i]); } int randomSort(id obj1, id obj2, void *context ) { // returns random number -1 0 1 return (random()%3 - 1); } (void)shuffle { // call custom sort function [puzzles sortUsingFunction:randomSort context:nil]; } Giving this result: NEW OLD ================= 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12

    Read the article

  • Best practice - Accessing preferences globally

    - by JK
    User preferences for my app is store in NSUserDefaults. This includes a "theme" preference, which needs to be accessed frequently by multiple classes. I would prefer not to call "[[NSUserDefaults standardUserDefaults] objectForKey:..." repeatedly as it makes for inconcise code and I assume will incur overhead. What is the preferred and most concise method for accessing preferences in any class?

    Read the article

  • Core data fetch only returns unique managed objects

    - by JK
    I execute a core data fetch which specifies a predicate as follows: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"identifier IN %@", favoritesIDs]; When there are duplicate items in the favoriteIDs array, the fetch request only returns 1 managed object. How can I ensure that more than one instance is fetched? Thank you.

    Read the article

  • Performance issue finding weekdays over a given period

    - by Oysio
    I have some methods that return the number of weekdays between two given dates. Since calling these methods become very expensive to call when the two dates lie years apart, I'm wondering how these methods could be refactored in a more efficient way. The returned result is correct but I feel that the iphone processor is struggling to keep up and consequently freezes up the application when I would call these methods over a period of say 10years. Any suggestions ? //daysList contains all weekdays that need to be found between the two dates -(NSInteger) numberOfWeekdaysFromDaysList:(NSMutableArray*) daysList startingFromDate:(NSDate*)startDate toDate:(NSDate*)endDate { NSInteger retNumdays = 0; for (Day *dayObject in [daysList objectEnumerator]) { if ([dayObject isChecked]) { retNumdays += [self numberOfWeekday:[dayObject weekdayNr] startingFromDate:startDate toDate:endDate]; } } return retNumdays; } -(NSInteger) numberOfWeekday:(NSInteger)day startingFromDate:(NSDate*)startDate toDate:(NSDate*)endDate { NSInteger numWeekdays = 0; NSDate *nextDate = startDate; NSComparisonResult result = [endDate compare:nextDate]; //Do while nextDate is in the past while (result == NSOrderedDescending || result == NSOrderedSame) { if ([NSDate weekdayFromDate:nextDate] == day) { numWeekdays++; } nextDate = [nextDate dateByAddingDays:1]; result = [endDate compare:nextDate]; } return numWeekdays; }

    Read the article

  • How to resize a UISwitch?

    - by mshsayem
    I have made a custom UISwitch (from this post). But the problem is, my custom texts are a bit long. Is there any way to resize the switch? [I tried setBounds, did not work] Edit: Here is the code I used: @interface CustomUISwitch : UISwitch - (void) setLeftLabelText: (NSString *) labelText; - (void) setRightLabelText: (NSString *) labelText; @end @implementation CustomUISwitch - (UIView *) slider { return [[self subviews] lastObject]; } - (UIView *) textHolder { return [[[self slider] subviews] objectAtIndex:2]; } - (UILabel *) leftLabel { return [[[self textHolder] subviews] objectAtIndex:0]; } - (UILabel *) rightLabel { return [[[self textHolder] subviews] objectAtIndex:1]; } - (void) setLeftLabelText: (NSString *) labelText { [[self leftLabel] setText:labelText]; } - (void) setRightLabelText: (NSString *) labelText { [[self rightLabel] setText:labelText]; } @end mySwitch = [[CustomUISwitch alloc] initWithFrame:CGRectZero]; //Tried these, but did not work //CGRect aFrame = mySwitch.frame; //aFrame.size.width = 200; //aFrame.size.height = 100; //mySwitch.frame = aFrame; [mySwitch setLeftLabelText: @"longValue1"]; [mySwitch setRightLabelText: @"longValue2"];

    Read the article

  • Xcode: Is there a location/flag to prevent a Class from compiling?

    - by Meltemi
    Is there a place (or flag) in Xcode for files that you don't want to compile? There are some classes that are/may become part of a project but currently won't compile. The main project doesn't link to them but Xcode still tries to compile them. Is there a way to prevent blocking the rest of project from compiling until these new Classes are "ready"?

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >