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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:29:52+00:00 2026-06-11T09:29:52+00:00

I have customized my table view cell accessory with button. Everything went fine until

  • 0

I have customized my table view cell accessory with button. Everything went fine until event handler.

Here is my code.
[EDIT]

 public class ProductTableSource: UITableViewSource
    {
        protected List<Product> tableItems = new List<Product> ();
        protected string cellIdentifier = "producdetailscell";
        private RootViewController controller;
        protected Transaction transaction; 
        public UIButton addItemButton;
        public UIImage Image;



        public ProductTableSource (List<Product> items, RootViewController controller)
        {
            this.tableItems = items;
            this.controller = controller;       
            Image = UIImage.FromFile ("Images/plus.png");
            addItemButton = UIButton.FromType(UIButtonType.Custom);
            var buttonFrame = new RectangleF (0f, 0f, Image.Size.Width, Image.Size.Height);
            addItemButton.Frame = buttonFrame;
            addItemButton.SetImage(Image, UIControlState.Normal);
            addItemButton.TouchUpInside += delegate {   
                Console.WriteLine ("Touched");

            };

        }

        public void setTableItem (List<Product> tableItems)
        {

            this.tableItems = tableItems;
        }

        /// <summary>
        /// Called by the TableView to determine how many cells to create for that particular section.
        /// </summary>
        public override int RowsInSection (UITableView tableview, int section)
        {
            return tableItems.Count;
        }

        /// <summary>
        /// Called when a row is touched
        /// </summary>

        public override void AccessoryButtonTapped (UITableView tableView, NSIndexPath indexPath)
        {

            var prod = controller.Productdetails[indexPath.Row];
            Double amount = 1*prod.SellingPriceA;
            transaction  = new Transaction();
            transaction.SetTransaction(controller.CustomerID, prod.ID, prod.Description1,1, prod.SellingPriceA,0.0,amount);
            controller.UpdateOrderedItemsTableView();

        }


        /// <summary>
        /// Called by the TableView to get the actual UITableViewCell to render for the particular row
        /// </summary>
        public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            // request a recycled cell to save memory
            UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
            // if there are no cells to reuse, crate a new one
            if (cell == null) {
                cell = new UITableViewCell (UITableViewCellStyle.Default, cellIdentifier);
            }

            var cust = controller.Productdetails [indexPath.Row];
            cell.TextLabel.Text = cust.Description1;


            cell.AccessoryView = this.controller.addItemButton;

            return cell;
        }



    }

Here is Error I am getting. Not sure what is going on. Perhaps I used inappropriate functions. Please suggestion me!!!

**Stacktrace:

  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff>
  at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
  at SalesOrder.Application.Main (string[]) [0x00000] in /Users/Mac/Projects/SalesOrderPolarisnet/SalesOrder/Main.cs:17
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:

    0   SalesOrder                          0x000908cc mono_handle_native_sigsegv + 284
    1   SalesOrder                          0x000056f8 mono_sigsegv_signal_handler + 248
    2   libsystem_c.dylib                   0x9613559b _sigtramp + 43
    3   ???                                 0xffffffff 0x0 + 4294967295
    4   UIKit                               0x022620e6 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
    5   UIKit                               0x02308ade -[UIControl sendAction:to:forEvent:] + 66
    6   UIKit                               0x02308fa7 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503
    7   UIKit                               0x02307d8a -[UIControl touchesBegan:withEvent:] + 264
    8   UIKit                               0x02523a1a _UIGestureRecognizerUpdate + 6725
    9   CoreFoundation                      0x011b099e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    10  CoreFoundation                      0x01147640 __CFRunLoopDoObservers + 384
    11  CoreFoundation                      0x011134c6 __CFRunLoopRun + 1174
    12  CoreFoundation                      0x01112d84 CFRunLoopRunSpecific + 212
    13  CoreFoundation                      0x01112c9b CFRunLoopRunInMode + 123
    14  GraphicsServices                    0x048307d8 GSEventRunModal + 190
    15  GraphicsServices                    0x0483088a GSEventRun + 103
    16  UIKit                               0x0225f626 UIApplicationMain + 1163
    17  ???                                 0x0d4d41f4 0x0 + 223166964
    18  ???                                 0x0d4d2f50 0x0 + 223162192
    19  ???                                 0x0d4d27c0 0x0 + 223160256
    20  ???                                 0x0d4d284f 0x0 + 223160399
    21  SalesOrder                          0x00009ab2 mono_jit_runtime_invoke + 722
    22  SalesOrder                          0x0016b34e mono_runtime_invoke + 126
    23  SalesOrder                          0x0016f4d4 mono_runtime_exec_main + 420
    24  SalesOrder                          0x001748c5 mono_runtime_run_main + 725
    25  SalesOrder                          0x00066cb5 mono_jit_exec + 149
    26  SalesOrder                          0x00203911 main + 2209
    27  SalesOrder                          0x00002ab5 start + 53

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================**
  • 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-11T09:29:54+00:00Added an answer on June 11, 2026 at 9:29 am

    It is possible that Mono’s GC collect and dispose your UIButtons since they’re declared as local variables. I recommend you to subclass UITableViewCell, include UIButton to it and then use that class in GetCell.

    BTW, it’s better to use TouchUpInside instead of TouchDown event.

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

Sidebar

Related Questions

i have an customized cell that is loaded in table view cell and each
UITableView custom cell showing weird results? I have my code below. Everything was showing
I have a class A that inherits UITableViewCell (to customize a table cell). It
I have a tableview cell in a view which has some text in it,the
In my application, i'm using a customised table. Each cell have an uibutton and
In my table view I have 4 UIButton s, 2 in each row of
I am trying to create 3 table view cells using code (w/o nib). I
Hey guys, I have a Table View that has been populated with 21 data:
we have a very customized UITableViewCell here. So it basically looks like this: +----------------+
In my app, I have a table view controller that creates a couple of

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.