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 8427927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:54:47+00:00 2026-06-10T04:54:47+00:00

I am sorry i am new to IOS,i couldnt figure out the solution to

  • 0

I am sorry i am new to IOS,i couldnt figure out the solution to this problem

This is just a beginner restaurant menu

There is a tableview containing items and price and when i click one item,it displays another view where the user has to input the quantity and click a done button,so when the user clicks done i want to multiply the quantity times the price,how do i retrieve that particular price and multiply it with the quantity user input in the textfield.

Here’s my code

I have declared NSDictionary in the Menu header file called

NSDictionary *dict;

My viewdidload method

dict=[[NSDictionaryalloc]initWithObjectsAndKeys:
@"TomatoSoup",@"20.00",@"VegManchowSoup",@"12.00",nil];
NSLog(@"%@",dict);
[super viewDidLoad];

I have displayed this contents in a table view

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

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

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

NSArray *sortedkeys=[[dict allKeys]sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSString *key=[sortedkeys objectAtIndex:indexPath.row];
NSString *value=[dict objectForKey:key];
cell.textLabel.text=value;
cell.detailTextLabel.text=key;
return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath{
if(indexPath.row==0){   

VegQuantity *vegetarian1 = [[VegQuantity alloc]   initWithNibName:@"VegQuantity" bundle:nil];
vegetarian1.m_SelectedIndexPath=indexPath.row;
vegetarian1.pass=dict;
[self presentModalViewController:vegetarian1 animated:YES];
}
if(indexPath.row==1){   

VegQuantity *vegetarian1 = [[VegQuantity alloc] initWithNibName:@"VegQuantity" bundle:nil];
vegetarian1.m_SelectedIndexPath=indexPath.row;
[self presentModalViewController:vegetarian1 animated:YES];
}
}

VegQuantity.h
There is a View that has a textfield and a button saying done,
now when I click the done button I need to retrieve the value for that particular soup and multiply it with the number of quantity I input.
My problem is how am I supposed to retrieve the price(value) for that particular key and multiply it with the quantity.

  • 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-10T04:54:49+00:00Added an answer on June 10, 2026 at 4:54 am

    You retrieve a value from a Dictionary by using.

    [dict objectForKey:@"someDummyKey"];
    

    But to be honest. You should use a NSMutableArray as datasource for you UITableView and not a NSDictionary.

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

Sidebar

Related Questions

Sorry if this is a really silly question but I'm new to iOS. I'm
I'm fairly new to iOS development so I'm sorry if this comes off as
Sorry I realise this is a simple question but im new to iOS development
Sorry, but I'm new to accessing return from another domain. I have this url
I'm new to this topic so sorry if this is a stupid question :\
new to this site so sorry if this question is inappropriate, or in the
Sorry, I am still new to Django, hopefully the question isn't out of place.
Sorry, I'm new to flash I have this line of code: BaseEntry( _entryList[i] ).topTeamName
I'm pretty new to iOS programming so sorry for any doh questions ;) I
Sorry i am new to C#. I have a program, where there is a

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.