Is there a way construct a predicate to filter by class type?
I currently loop through the array and check to the class of each object. Maybe there is a cleaner way?
I have an array of images, and two nib files. One nib file has a window that displays the images in an NSTableView. The other nib has a window that draws the array of images into an NSView, and also draws a highlight over the images that are selected.
The array of images is controlled by an NSArrayController. I'm having trouble getting the two…
I have a NIB that contains a UIView.
I have another NIB that contains a UITableView.
How can I load the UITableView NIB inside of the UIView in my other NIB?
Yet another iPhone/Objective-C noob question. I'm using a singleton to store app state information. I'm including the singleton in a Utilities class that holds it (and eventually other stuff). This utilities class is in turn included and used from various view controllers, etc. The utilities class is set up like this:
// Utilities.h…
I figured out the answer to this question, but I couldn't find the solution on here, so posting it for posterity.
So, in Objective-C, how do you create an object out of a pointer in order to store it in objective-c collections (NSArray, NSDictionary, NSSet, etc) without reverting to regular C?
I'm utilising the AddressBook.framework in my iPhone app, and I'd like to replicate something along the lines of the share feature in Contacts.app. This basically attach's a specific contacts vCard to an email. As far as I know, there is nothing in the documentation that mentions generating a vCard.
Is this a case of generating one…
I've a Core Data application. In the producer thread, I pull data from a web service and store it in my object and call save.
My consumer object is a table view controller that displays the same.
However, the app crashes and I get
NSFetchedResultsController Error: expected to find object (entity: FeedEntry; id: 0xf46f40 ; data: )…
I'm trying to find the boundaries of a line of text in Core Text. For simplicity, assume it has a single character.
At the moment I'm using the following method:
line = CTLineCreateWithAttributedString(attrString);
rect = CTLineGetImageBounds(line, context);
It works most of the times, but for some characters, like math italic d…
Generally, I use static arrays and dictionaries for containing lookup tables in my classes. However, with the number of classes creeping quickly into the hundreds, I'm hesitant to continue using this pattern. Even if these static collections are initialized lazily, I've essentially got a bounded memory leak going on as someone…
Hi,
Can someone please explain why the following code causes my app to bomb?
NSData *myImage = UIImagePNGRepresentation(imageView.image);
:
[myImage release];
If I comment out the 'release' line, the app runs... but a few times calling the function containing this code and I get a crash - I guess caused by a memory leak.
…
I want to call a method with certain parameters once an animation is done.
The flow is something like this:
-(void) myMethod:(int)val
{
[self performAnimation];
[self doSomethingElse:val]; // This should be done after animation completion
}
I presume the 'doSomethingElse' method needs to be called from the…
I have an iTunes style interface in my application: Source list (NSOutlineView) on the left that contains different libraries and playlists with an NSTableView on the right side of the interface displaying information for "Presentations". Similar to iTunes, I am showing the same type of information in the table view…
I wish to use NSNumberFormatter to merely attached a percent ('%') to the supplied number WITHOUT having it multiplied by 100.
The canned kCFNumberFormatterPercentStyle automatically x100 which I don't want.
For example, converting 5.0 to 5.0% versus 500%.
Using the following:
NSNumberFormatter *percentFormatter…
Hi,
I've created an animation loop which I run as an operation in order to keep the rest of my interface responsive. Whilst almost there, there is still one remaining issue. My UIScrollViews don't seem to be reliably picking up when a user touch ends. What this means is, for example, if a user drags down on a…
Let's say I have an NSArray of NSDictionaries that is 10 elements long. I want to create a second NSArray with the values for a single key on each dictionary. The best way I can figure to do this is:
NSMutableArray *nameArray = [[NSMutableArray alloc] initWithCapacity:[array count]];
for…
I have two UITabBarControllers in my mainwnidow.nib wired to my appdelegate.
In my app delegate, I can load either one:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//either
[window addSubview:tabBarController.view];
//or…
I would like to implement an observer pattern in Objective-C where the observer implements an interface similar to SKPaymentTransactionObserver and the observable class just extends my base observable. My observable class looks something like what is below. Notice I'm making copies of the…
Questions on calling web services from iPhone?
Anyone have any recommended tutorials on doing this?
Anyone have any best practices on implementing security with these calls?
Has anyone made or seen any shared libraries or wrappers for easy web service calls from the iPhone?
I have an application that uses MKMapView and at some point in the app I need to remove all the current pins in the map using
[mapView removeAnnotations:mapView.annotations]
And then I want to show again the current user location
mapView.showUserLocation = YES
But I can only make it…
I have an iPhone project which references a framework as a subproject.
The framework has the following configurations:
Debug
Release
My app has the following configurations:
Debug
Release
Distribution-AdHoc
Distribution-AppStore
I would like the framework to be built with…
Even though Interface Builder is aware of a MyClass, I get an error when starting the application.
This happens when MyClass is part of a library, and does not happen if I compile the class directly in the application target.
Hi !
I have come to a problem, wich I have no idea how to solve. Can anyone think outside the box and point me to right directions? I would be very thankfull !
The problem.
I have a UITableView containing a first row wich is always the same (a empty row with repeating…
I'm building a carArray and want to filter the contents conditionally, using an NSPredicate, like so:
NSPredicate *pred;
switch (carType) {
case FreeCar:
pred = [NSPredicate predicateWithFormat:@"premium = NO"];
break;
case PremiumCar:
pred = [NSPredicate…