Convert NSArray to NSString in Objective-C
I am wondering how to convert an NSArray [@”Apple”, @”Pear “, 323, @”Orange”] to a string in Objective-C. 9 Answers 9
I am wondering how to convert an NSArray [@”Apple”, @”Pear “, 323, @”Orange”] to a string in Objective-C. 9 Answers 9
I have a custom UITableView using UITableViewCells. Each UITableViewCell has 2 buttons. Clicking these buttons will change an image in a UIImageView within the cell. Is it possible to refresh each cell separately to display the new image? Any help is appreciated. 9 Answers 9
I have read several of the post about Objective-C method syntax but I guess I don’t understand multiple names for a method. I’m trying to create a method called getBusStops with NSString and NSTimeInterval parameters and a return type of NSMutableArray. This is how I have constructed the method but it obviously gets errors at … Read more
I was going through the release notes for Xcode 4.4 and noticed this: LLVM 4.0 Compiler Xcode now includes the Apple LLVM Compiler version 4.0, including the following newObjective-C language features: […] – Objective-C literals: create literals for NSArray, NSDictionary, and NSNumber, just the same as the literals for NSString I’m intrigued about this feature. … Read more
How do I convert a negative number to an absolute value in Objective-C? i.e. -10 becomes 10? 3 Answers 3
I would like to check whether an object (e.g. someObject) is assignable (cast-able) to a variable of another type (e.g. SpecifiedType). In Java, I can write: someObject instanceof SpecifiedType A related question is finding whether the runtime type of an object is equal to a another type. In Java, I can write: someObject.getClass().equals(SpecifiedType.class) How can … Read more
If you have an NSMutableArray, how do you shuffle the elements randomly? (I have my own answer for this, which is posted below, but I’m new to Cocoa and I’m interested to know if there is a better way.) Update: As noted by @Mukesh, as of iOS 10+ and macOS 10.12+, there is an -[NSMutableArray … Read more
I’m working through some exercises and have got a warning that states: Implicit conversion loses integer precision: ‘NSUInteger’ (aka ‘unsigned long’) to ‘int’ #import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { @autoreleasepool { NSArray *myColors; int i; int count; myColors = @[@”Red”, @”Green”, @”Blue”, @”Yellow”]; count = myColors.count; // <<< issue warning … Read more
How do I change time and time zone in the iPhone simulator? 12 Answers 12
In Objective-C, I would like to know what the + and – signs next to a method definition mean. – (void)loadPluginsAtPath:(NSString*)pluginPath errors:(NSArray **)errors; 4 Answers 4