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

  • SEARCH
  • Home
  • 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 9137855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:10:51+00:00 2026-06-17T09:10:51+00:00

I’m new to iOS development and I’m trying to build a dictionary. My first

  • 0

I’m new to iOS development and I’m trying to build a dictionary. My first screen just has a search bar on top and a TableView of all the entries underneath. When you type in the search bar, the TableView is filtered with the entries that match. When you click on any of the cells either in list-all mode or filtered mode, another view is pushed showing the name of the word and the definition.

I am already able to open a new screen whenever I click on the table cells, but for some reason, the two labels in the new screen (the word and the definition) just won’t be updated with the selection–it stays empty. I think I’ve correctly set up these two IBOutlets in my XIB file though, because when I log the text attributes of the UILabels, they print out correctly. Help?

EntryViewController.h (the second screen):

#import <UIKit/UIKit.h>

@interface EntryViewController : UIViewController

@property (nonatomic, strong) IBOutlet UILabel *word;
@property (nonatomic, strong) IBOutlet UILabel *definition;

@end

EntryViewController.m:

#import "EntryViewController.h"

@implementation EntryViewController

@synthesize word, definition;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    self.word = [[UILabel alloc] init];
    self.definition = [[UILabel alloc] init];
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationController setNavigationBarHidden:NO];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

UTVTViewController.h (the first screen):

#import <UIKit/UIKit.h>
#import "EntryViewController.h"

@interface UTVTViewController : UIViewController <UITableViewDataSource, UITableViewDelegate,
    UISearchBarDelegate, UISearchDisplayDelegate>

@property (nonatomic, strong) IBOutlet UITableView *sampleTableView;
@property (nonatomic, strong) NSMutableDictionary *entries;
@property (nonatomic, strong) NSMutableArray *sortedWords, *filteredList;
@property (nonatomic) BOOL isSearching;
@property (nonatomic, retain) EntryViewController *entryView;

- (void)filterListForSearchText:(NSString *)searchText;

@end

UTVTViewController.m

#import "UTVTViewController.h"
#import "EntryViewController.h"

@implementation UTVTViewController

@synthesize sampleTableView, entries, sortedWords, filteredList, isSearching, entryView;

- (void)viewDidLoad {
    [super viewDidLoad];
    entries = [NSMutableDictionary new];
    [entries setObject:@"a syndrome of wide spaced eyes (ocular hypertelorism), front-facing (anteverted) nostrils, a broad upper lip, a malformed (\"saddle-bag\") scrotum, and laxity of the ligaments resulting in bending back of the knees (genu recurvatum), flat feet, and overly extensible fingers. There are X-linked and autosomal forms of the disease. The gene for the X-linked form has been mapped to chromosome band Xp11.21 and identified as the FGD1 gene." forKey:@"aarskog-scott syndrome"];
    [entries setObject:@"a diminution, decrease or easing. In medicine there may be abatement of pain or any other symptom or sign. In the environment there may abatement in the degree of pollution" forKey:@"abatement"];
    [entries setObject:@"a disorder marked by a pathological pattern of alcohol use that causes serious impairment in social or occupational functioning. It includes both alcohol abuse and alcohol dependence." forKey:@"alcoholism"];
    // ...other words

    sortedWords = [[NSMutableArray alloc] initWithArray:[[entries allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]];
    filteredList = [[NSMutableArray alloc] init];
    isSearching = NO;
}

// ...

#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *selection;
    if (isSearching && [filteredList count]) {
        selection = [filteredList objectAtIndex:indexPath.row];
    } else {
        selection = [sortedWords objectAtIndex:indexPath.row];
    }

    EntryViewController *evc = [[EntryViewController alloc] initWithNibName:@"EntryView" bundle:nil];
    evc.title = selection;

    [evc.word setText:selection];
    [evc.definition setText:[entries objectForKey:selection]];
    NSLog(@"word=%@", evc.word.text);
    NSLog(@"definition=%@", evc.definition.text);

    [[self navigationController] pushViewController:evc animated:YES];
}

@end

EDIT: I’m including the header and implementation files for the AppDelegate. I have a feeling the error is somewhere in the navigationController which I have currently not connected to anything, but I don’t even know where to attach it since I don’t have one in my XIB.

UTVTAppDelegate.h:

@interface UTVTAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UTVTViewController *viewController;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

@end

UTVTAppDelegate.m

@implementation UTVTAppDelegate

@synthesize navigationController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.viewController = [[UTVTViewController alloc] initWithNibName:@"UTVTViewController" bundle:nil];
    self.window.rootViewController = self.viewController;

    navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
    [navigationController setNavigationBarHidden:YES];

    [self.window addSubview:navigationController.view];
    [self.window makeKeyAndVisible];
    return YES;
}

// default Xcode methods

@end
  • 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-06-17T09:10:52+00:00Added an answer on June 17, 2026 at 9:10 am

    In the didSelectRowAtIndexPath method, I was setting the UILabel‘s texts before pushing the view controller to the navigation controller. Solution:

    [[self navigationController] pushViewController:evc animated:YES];
    [evc.word setText:selection];
    [evc.definition setText:[entries objectForKey:selection]];
    

    I also removed the lines in my code where I called alloc on detached UILabel objects.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace

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.