class - Let User Create Objects On Runtime (Objective-C) -


i've had many forum, time can't find answer question on forum, ask here. hope guys can me , topic useful others around here.

i started programming months ago, (i want make job, next year go college learn it, myself now.) , it.

i reading book "programming in objective-c (fourth edition)" steve kochan. didn't finish yet, it's book real beginners in programming.

now started programming apps myself. in case it's order-tracking app. user can press + or - button increase quantity has order. added 4 products myself (objects "product"-class), want give user of app ability add custom products himself. here code: (it's simple, messing around little bit)

product.h:

#import <foundation/foundation.h>  @interface product : nsobject {     unsigned int valueofproducts; }  -(void) increasevalueofproducts; -(void) decreasevalueofproducts; -(void) resetvalueofproducts;  @end 

product.m:

#import "product.h"  @implementation product  -(void) increasevalueofproducts {     valueofproducts += 1; }  -(void) decreasevalueofproducts {      if ( valueofproducts > 0 ) {         valueofproducts -= 1;     } }  -(void) resetvalueofproducts {     valueofproducts = 0; }  @end 

main.m:

#import "product.h"  int main(int argc, char *argv[]) {     @autoreleasepool {          product *sandwich = [[product alloc] init];         product *coke = [[product alloc] init];         product *chips = [[product alloc] init];         product *bread = [[product alloc] init];      } } 

now question: is there method, or something, can add user can add objects (so, new products) program wants keep track of?

i don't remember have had in book, , don't know search for. hope can me this.

many responding!

ps: hope added code in post on right way.

you can't go non-ui, command line, programming ui programming , expect things work @ same.

if want user input, need text field on screen user enters stuff , means of submitting text program such updates product instance; button, return key, something.

this require basic understanding of how applications structured, how load or dynamically create user interface, how process user input, how connect ui data storage classes/instances, etc...

it sounds need move on kochan book -- seems more focused on language level stuff , less on building real world apps? -- , use tutorials teach how build gui apps.

apple provides ton of getting started guides...


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -