nsmutablearray

NSMutableArray and NSDictionary using for parsed xml data

好久不见. 提交于 2019-12-25 03:58:09
问题 Please anybody help me.i am in great trouble....Now my Problem is... Using xml parser i have parsed some attribute and value of the attribute. using this i am getting the element name: - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes: (NSDictionary *)attributeDict Now using this i am getting value of the attribute from the xml: - (void)parser:(NSXMLParser *)parser foundCharacters:

Is it possible to delete dictionary from mutablearray while iterating? [duplicate]

大兔子大兔子 提交于 2019-12-25 03:29:11
问题 This question already has answers here : Deleting objects within a for loop from a NSMutableArray (2 answers) Closed 5 years ago . for (int i = 0; i< [optionDataArr count]; i++) { NSString *sName = [[optionDataArr objectAtIndex:i] objectForKey:kOptionName]; NSString *sPrice = [[optionDataArr objectAtIndex:i] objectForKey:kOptionExtraPrice]; if (sName.length == 0 && sPrice.length == 0) { [optionDataArr removeObjectAtIndex:i]; } } Suppose optionDataArr contains a dictionary having no values and

Objective-C appDelegate array

僤鯓⒐⒋嵵緔 提交于 2019-12-25 03:27:39
问题 I'm creating a SQLite application, with two simple views. I have two arrays in SQLAppDelegate: - (void)applicationDidFinishLaunching:(UIApplication *)application { NSMutableArray *tempArray = [[NSMutableArray alloc] init]; self.modelArray = tempArray; self.detailArray = tempArray; [tempArray release]; So now in my implementation file I am populating "modelArray" with the contents of a SQLite table and displaying this in the first view: + (void) getInitialDataToDisplay:(NSString *)dbPath {

Save a NSArray to iCloud and retrieve it

隐身守侯 提交于 2019-12-25 03:18:24
问题 I have an app that currently saves a NSMutableArray to a file in the documents directory on the iPad. This is saved by [residentData writeToFile:filePath atomically:NO]; and is read back in by; residentData = [[NSMutableArray alloc] initWithContentsOfFile:filePath]; I need to write this file to iCloud, as the data needs to be available across several devices. I have tried the following to create the file in iCloud; NSData *myFileData = [NSKeyedArchiver archivedDataWithRootObject:residentData]

How to avoid “NSInternalInconsistencyException” in iPhone?

被刻印的时光 ゝ 提交于 2019-12-25 02:46:21
问题 I am sorting an mutable array. For sorting I use: NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"pubDate" ascending:NO]; [recent sortUsingDescriptors:[NSArray arrayWithObjects:descriptor, nil]]; recent1 = [recent sortedArrayUsingDescriptors:descriptor]; [descriptor release]; I am getting this error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable

Objective C: What is the best way to create and use a dynamic boolean array?

可紊 提交于 2019-12-25 02:38:37
问题 I have been struggling with the best way of creating, accessing and updating values from a dynamic boolean array for more than a week now. @interface myDelegate : NSObject { NSMutableArray *aShowNote; } @property (nonatomic, copy) NSMutableArray *aShowNote; This is how I have initialised my array: NSMutableArray *aShow = [[NSMutableArray alloc] init]; for (i=0; i < c; i++) [aShow addObject:[NSNumber numberWithBool:false]]; self.aShowNote = aShow; This seems to work OK but I'm baffled why each

Using Three20's TTLauncherView: Need help with splitting and adding remaining objects from an NSMutableArray to an NSArray in Objective-C

不羁岁月 提交于 2019-12-25 01:52:38
问题 I am now using this code: - (void)loadLauncher:(NSMutableArray *)categoriesArray { _launcherView = [[TTLauncherView alloc] initWithFrame:self.view.bounds]; _launcherView.columnCount = 3; // Number of pages in your launcherView. NSMutableArray *pages = [[NSMutableArray alloc] initWithCapacity:2]; int numberOfObjects = [categoriesArray count]; // The launcherItems in each page, calculate automatically the number of objects available for the launcher. NSMutableArray *launcherItems = [

How divide array and show in table view?

大兔子大兔子 提交于 2019-12-25 01:25:17
问题 I am developing a table view. To fill that table i have an array of 75 content. Now i want to show table view like as when first time shown table view then show only 10 row of array and one button whose title is show more. when click on button then show next 10 content of array in table view and in last of table view show two button previous and next. When click on next then again show next 10 content of array and when click on previous then show previous 10 content. Now problem is that what

NSMutable array - “Not an objective-C object” error

守給你的承諾、 提交于 2019-12-24 20:23:03
问题 I am not totally sure why it is that it is returning the error "not an objective-C object" at the commented line. Any help would be appreciated. Additionally, I am very new to objective-C, and I do realize there is a high possibility this is a very silly mistake. However any advice will help. #import "CalculatorBrain.h" @interface CalculatorBrain() @property (nonatomic, strong) NSMutableArray *operandStack; @end @implementation CalculatorBrain @synthesize operandStack = _operandStack; -

UITableView

久未见 提交于 2019-12-24 19:34:10
//非原创   UITableView是app开发中常用到的控件,功能很强大,多用于数据的显示。下面以一个简单的实例来介绍tableview的基本用法。(适合新手,高手飘过) @interface TableViewTestViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>{ UITableView *DataTable; NSMutableArray *dataArray1; //定义数据数组1 NSMutableArray *dataArray2;//定义数据数组2 NSMutableArray *titleArray;//定义标题数组 } - (void)viewDidLoad { [superviewDidLoad]; //初始化tableview DataTable = [[UITableViewalloc] initWithFrame:CGRectMake(0, 0, 320, 420)];//指定位置大小 [DataTablesetDelegate:self];//指定委托 [DataTablesetDataSource:self];//指定数据委托 [self.viewaddSubview:DataTable];//加载tableview dataArray1 =