Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5991169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:20:55+00:00 2026-05-22T23:20:55+00:00

Below is a simple example of how I’m reading from a plist and displaying

  • 0

Below is a simple example of how I’m reading from a plist and displaying the data in a table view. If I were to use a objects to represent my model, how would I be doing that?

@interface RootViewController : UITableViewController {
    NSMutableArray *namesArray;
}
@property (nonatomic, retain) NSMutableArray *namesArray;
@end


@implementation RootViewController
@synthesize namesArray;

- (void)viewDidLoad{
    [super viewDidLoad];

    NSString *path = [[NSBundle mainBundle] pathForResource:@"names" ofType:@"plist"];

    NSMutableArray *tempArray = [[NSMutableArray alloc]initWithContentsOfFile:path];

    self.namesArray = tempArray;

    [tempArray release];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [namesArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    cell.textLabel.text = [namesArray objectAtIndex:indexPath.row];
    return cell;
}

Can anyone show me the proper way of constructing my Model as per MVC pattern for the above scenario? I’m guessing I would be using a singleton to return a set of Name objects. I basically want to learn the correct manner of using Model objects to represent my data.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:20:56+00:00Added an answer on May 22, 2026 at 11:20 pm

    The Model in iOS MVC simply divides up your application so that the data and application algorithms (Model) are separated from the presentation and event handling code. So consider creating a new Model class that gets, sets and persist your application data. This class should have no knowledge of the GUI.

    Here is an example of a model that wraps the application algorithms by handling encryption decryption.

    #import <Foundation/Foundation.h>
    #import <CommonCrypto/CommonCryptor.h>
    #import <CommonCrypto/CommonDigest.h>
    #import <Security/Security.h>
    
    
    @interface Model : NSObject {
    }
    +(id)modelGetInstance;
    +(NSData *)getRandomIV:(NSInteger)numBytes;
    -(id)init;
    -(NSString*)encrypt:(NSString*)plainText password:(NSString*)pw; // public
    -(NSString*)decrypt:(NSString*)cipherText password:(NSString*)pw;  // public
    @end
    

    This is similar to UNIX ENGINE-INTERFACE. This is NOT the MVC of Smalltalk in which the View is directly updated by changes in the MODEL (Observer pattern).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the simple example below, what is the best way to return results from
Below I have a very simple example of what I'm trying to do. I
Below is the code of a simple html with a table layout. In FF
Take a simple table like below: Column Headings: || Agent's Name || Time Logged
Please See The Simple Example Below For Understanding My situation. (Attention To Comments Inside
How can you specify an embedded field as nullable? In the simple example below
I am trying to get a simple example working from an assembly book I
Below is a simple example of using pointer in delphi. Type TRecord1 = Record
Let's start with a simple example. A HTTP data stream comes in the following
Below is a simple example of my PHP code which (I hope so) is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.