nsmutablearray

Iphone Programming XML Parser NSMutableArray

空扰寡人 提交于 2020-01-06 15:06:03
问题 I am currently having a problem with parsing information from an XML into an NSMutableArray, i have pasted the code below which is for the parser this retrieves the document off the internet and constructs the array. I am then trying to copy the items from the xml parser into an NSMutableArray for searching, but every time i try to copy the array it returns a struct error so i have removed the changes for now. Here is the code for the parser and the current code for the viewdidload in the

Can I restrict the NSMutableArray object type?

大城市里の小女人 提交于 2020-01-06 09:55:11
问题 I want the NSMutableArray only store "MyObject" only... ...instead of any objects. How can I do this? thz. 回答1: There is no concept like C# Generics or C++ Templates in Objective-C, as discussed here before, but you could create a class which exposes an array and has add and remove-methods which take only your object type (see here). 来源: https://stackoverflow.com/questions/2690821/can-i-restrict-the-nsmutablearray-object-type

Can I restrict the NSMutableArray object type?

有些话、适合烂在心里 提交于 2020-01-06 09:55:11
问题 I want the NSMutableArray only store "MyObject" only... ...instead of any objects. How can I do this? thz. 回答1: There is no concept like C# Generics or C++ Templates in Objective-C, as discussed here before, but you could create a class which exposes an array and has add and remove-methods which take only your object type (see here). 来源: https://stackoverflow.com/questions/2690821/can-i-restrict-the-nsmutablearray-object-type

Objective C: Terminating app due to uncaught exception 'NSInvalidArgumentException'

安稳与你 提交于 2020-01-06 04:31:32
问题 My app is crashing with the error "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayer firstName]: unrecognized selector sent to instance 0x4d382c0'". This is what I was trying to do. 1) I have created a 'Person' class to store information like firstName, lastName, email add and telephone number Person.m file: @implementation Person @synthesize firstName, lastName, email, phoneNumber; -(Person *)initWithfirstName:(NSString *)thisFirstName lastName:

Objective C: Terminating app due to uncaught exception 'NSInvalidArgumentException'

丶灬走出姿态 提交于 2020-01-06 04:31:05
问题 My app is crashing with the error "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayer firstName]: unrecognized selector sent to instance 0x4d382c0'". This is what I was trying to do. 1) I have created a 'Person' class to store information like firstName, lastName, email add and telephone number Person.m file: @implementation Person @synthesize firstName, lastName, email, phoneNumber; -(Person *)initWithfirstName:(NSString *)thisFirstName lastName:

Adding array from one view to another and retaining values

半世苍凉 提交于 2020-01-06 04:30:43
问题 I have four views, with four arrays. As soon as I navigate from one view, I add that particular array to my master array. Initially this master array has nothing, and is allocated when the app runs using 'init' method. It does not have a view and it is an array from a subclass of NSObject . Finally the master array should consist of {viewarray1, viewarray2, viewarray3, viewarray4}. Each array is added to the master array when navigating to the next view. So is there anything wrong in my

Xcode: Compare two NSMutableArrays

岁酱吖の 提交于 2020-01-06 02:18:08
问题 I have two NSMutableArrays(initialized from plist file contents) that contains Dictionary objects. Could anyone please help me with the best method to achieve following result. The structure of Array is: I want to compare two following arrays to get the old entries which is not exists in new array. Old Array: <dict> <key>ResourceId</key> <string>352</string> </dict> <dict> <key>ResourceId</key> <string>3115</string> </dict> New Array: <dict> <key>ResourceId</key> <string>352</string> </dict>

NSMutableArray of ViewControllers

混江龙づ霸主 提交于 2020-01-05 15:13:09
问题 I am woundering how I could create an NSMutableArray of viewcontrollers. Then once I had that array how could I use it in a method that detects left and right UIgesture swipes to animate in and out of view... this is the method that is picking up my gestures which is just animating between two views, however I would like to animate between as many views that are in the array of view controllers. - (void)swipedScreen:(UISwipeGestureRecognizer*)gesture { //Left swipe if (gesture.direction ==

NSArray size and mutability

最后都变了- 提交于 2020-01-05 09:45:14
问题 In Java, I commonly initialize arrays that are a specific size and then add and replace objects as my code goes on. In Objective C, I can't do that with an NSArray. Code that I have ported over from Java often has to use NSMutableArray, which I assume perform less efficent than NSArray. (My best guess as to how NSMutableArray stores it's members is using a linked list, but I could be wrong) Are there any types of arrays for Objective C that have fixed sizes and allow changes within the array?

Objective C : UIButton image with NSArray in a random order

a 夏天 提交于 2020-01-05 09:05:48
问题 Brief Idea about the flow : I have say minimum 1 and maximum 18 records in my database with a text and an image from which I have to fetch images and place any 3 of the same randomly to 3 UIButtons among which one image should match with my question. i.e. 1 is the answer and other 2 are the distractors. For Example : Question is : where is Apple? Now among the bunch of images, I want to place any 3 images on the 3 UIButtons(1 answer i.e. An Apple and 2 distractors) in a random order and on