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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:59:41+00:00 2026-05-25T05:59:41+00:00

My problem seems simple but i can’t get the answer. I have a UiSwitch

  • 0

My problem seems simple but i can’t get the answer. I have a UiSwitch created in my TableItemCell subclass and I want him to call a function (dismiss in my case) from my tableviewcontroller that is instatiate.

How do I access this function from my subclass of TableItemCell ?

This is my code :

@implementation CCSettingsTableItemCell
@synthesize idSetting;

//Overriding cell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)identifier {
    if ((self = [super initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:identifier])) {
        switchView = [[UISwitch alloc] initWithFrame:CGRectZero];
        self.accessoryView = switchView;
        [switchView addTarget:self action:@selector(switchChanged:) forControlEvents:UIControlEventValueChanged];
        [switchView release];
    }
    return self;
}

- (void) switchChanged:(id)sender {
    UISwitch* switchControl = sender;

    /////////////////////////////////////////////////////////
    //Here i want to call my function from my main controller

}

And my main controller code is as this :

@implementation SettingController

///////////////////////////////////////////////////////////////////////////////////////////////////
// private

// This is the function i want to call
- (void)dismiss {
    [self dismissModalViewControllerAnimated:YES];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// NSObject

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    random code;
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// TTTableViewController

- (void)loadView {
    random code;
}

- (void)createModel {
    self.dataSource = [SettingControllerDataSource viewDataSource];

    // If dataSource nil, show an empty Message
    if (self.dataSource == nil) {
        [self showEmpty:YES];
    }
}

@end

Clarification : the datasource adds object of my customcell type CCSettingsTableItem

Any help or hints would be great !

  • 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-25T05:59:41+00:00Added an answer on May 25, 2026 at 5:59 am
    1. You can use @protocol which declares your “dismiss” method which is implemented by your SettingController. Conform SettingController class to CCSettingsTableItemCell.

    2. Otherwise create an object of SettingController in the .h file of CCSettingsTableItemCell. Use this object to call “dismiss” method.

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

Sidebar

Related Questions

This seems like a simple problem but I can't seem to find the answer.
my problem seems simple but I can not manage to find an answer here.
My problem seems to be really simple but I just can't get the reason
I have what seems to be a simple problem but I can't figure it
Here's what I want to do. It seems simple, but I can't get it
Seems like a simple problem, but can't get this to work. In the example
This one seems to be a simple problem, but I can't make it work
My problem seems simple, but for some reason, I can't quite seem to fix
I suppose my problem is simple but i can't get it fixed... Here is
This seems like a simple problem but I have a coder's mental block: The

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.