Note that there are some explanatory texts on larger screens.

plurals
  1. POIterate through NS array of obs
    primarykey
    data
    text
    <p>I need to take this data structure, an nsmutablearray, and iterate through each index and print each field into a textfield. every "forward" button increments the data ahead and "backwards" goes back. I am having a really hard time getting this to work properly, does anyone know what im doing wrong. Keep in mind, the object held in the array, called info_holder, is an object that holds 3 strings and one counter:</p> <pre><code>#import "ZDViewController.h" @implementation ZDViewController @synthesize password; @synthesize count; @synthesize web; @synthesize username; @synthesize header; - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } #pragma mark - View lifecycle - (void)viewDidLoad { [super viewDidLoad]; NSMutableArray *array = [[NSMutableArray alloc] init]; info_holder *set1 = [[info_holder alloc] init]; info_holder *set2 = [[info_holder alloc] init]; info_holder *set3 = [[info_holder alloc] init]; info_holder *set4 = [[info_holder alloc] init]; info_holder *set5 = [[info_holder alloc] init]; [set1 SetUser: @"info1"]; //temporary information until big is fixed [set1 SetPass: @"info2"]; [set1 SetKey: @"webinfo1"]; [set1 SetCount: 0]; [set2 SetUser: @"info3"]; [set2 SetPass: @"info4"]; [set2 SetKey: @"webinfo2"]; [set2 SetCount: 0]; [set3 SetUser: @"info5"]; [set3 SetPass: @"info6"]; [set3 SetKey: @"webinfo3"]; [set3 SetCount: 0]; [set4 SetUser: @"info7"]; [set4 SetPass: @"info8"]; [set4 SetKey: @"webinfo4"]; [set4 SetCount: 0]; [set5 SetUser: @"info9"]; [set5 SetPass: @"info10"]; [set5 SetKey: @"Webinfo5"]; [set5 SetCount: 0]; } - (void)viewDidUnload { [self setHeader:nil]; [self setWeb:nil]; [self setPassword:nil]; [self setCount:nil]; [self setUsername:nil]; [super viewDidUnload]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; } - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } - (IBAction)increment:(id)sender { if(username.text==@"test") username.text=@"test2"; else username.text=@"test"; //this should print a new username NSSTRING, wedsite NSTRING, password NSTRING and INEGER counter, heald in the info_holder object, incremented per click backwards } - (IBAction)decrement:(id)sender { } - (IBAction)Inc:(id)sender { } - (IBAction)textFieldDoneEditing:(id)sender { [sender resignFirstResponder]; } - (IBAction)backgroundTap:(id)sender { [web resignFirstResponder]; [username resignFirstResponder]; [count resignFirstResponder]; [password resignFirstResponder]; } @end </code></pre> <p>and my main is:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "ZDAppDelegate.h" #import "info_holder.h" int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([ZDAppDelegate class])); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload