Iphone app, object oriented design ideas

I am a developer of Objective-C Java training for the IPhone project; my question is about the OOP design in Cocoa. I have a view-based application that communicates with a web service and returns xml, parses and matches its corresponding view component (for example, if this date shows a question with datepicker, if the question has 2 values ​​show it with segmented control, if more with pickerview..etc), so its a dynamic question with many pages.

What is the best design to consider considering the structure of cocoa, for example, if I create a class called “Connection” to create a web request, can I create a connection object from my ViewController class and use it? or should I use delegete classes for this ... because my class will include methods such as:

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
 [webData setLength: 0];
}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
 [webData appendData:data];
}

Should this kind of implemented methods be higher in the viewcontroller class?

, xml ? , , , elses , " uiview", , . - . , , , ,

-(NSInteger)pickerView:(UIPickerView *)pickerView
numberOfRowsInComponent:(NSInteger)component
{
return [itemArray count];
} 

? , .

, .

0
2

1 , factory/engine, . ( java-), viewcontrollers . , , - .

2, factory/engine .

+1

, . . , , .

, NSURLConnection, , , , , , .

, , NSURLConnection.

, . ​​, , . , . , - .

.

+1

Source: https://habr.com/ru/post/1705920/


All Articles