可以在没有更改页面或runonuithread的情况下更改表格单元格行

时间:2014-07-16 07:25:59

标签: ios uitableview service xamarin.ios xamarin

我有一个服务代码,如果我保存该行应该改变颜色,但我点击后没有改变。但是,如果我用segue更改页面,则下一个结果可用,我使用runoithread并重新加载表数据但不起作用。任何的想法?我的代码广告底部可用

第一张图片:http://i.stack.imgur.com/DHl9A.png   和第二张图片http://i.stack.imgur.com/W8jYj.png

这里我的getcell和底部的保存按钮

public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
            {
                UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);

                var cellStlye = UITableViewCellStyle.Subtitle;
                if (cell == null) {
                    cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cellIdentifier);
                }

                cell.TextLabel.Text = tableItemsX [indexPath.Row].MesajBasligi;
                cell.DetailTextLabel.Text = tableItemsX [indexPath.Row].CagriAcan;
                //  cell.Accessory = UITableViewCellAccessory.Checkmark;



                if (tableItemsX [indexPath.Row].Durum == true) {

                    cell.TextLabel.TextColor = UIColor.White;
                    cell.DetailTextLabel.TextColor = UIColor.White;
                    cell.BackgroundColor = UIColor.FromRGB (74, 160, 44);
                    cell.Accessory = UITableViewCellAccessory.Checkmark;
                    cell.TintColor = UIColor.FromRGB (43, 84, 126);

                } else {
                    cell.BackgroundColor = UIColor.FromRGB (43, 84, 126);
                    cell.Accessory = UITableViewCellAccessory.DetailButton;
                    cell.TextLabel.TextColor = UIColor.White;
                    cell.DetailTextLabel.TextColor = UIColor.White;
                    cell.TintColor = UIColor.FromRGB (74, 160, 44);

                }



                return cell;
            }



up.Process.Clicked += delegate {
                    new System.Threading.Thread (new System.Threading.ThreadStart (() => {
                        InvokeOnMainThread (() => {

                            bool state;

                            if (up.durumT.On)
                                state = true;
                            else
                                state = false;


                            var responseX = up.client.Post (new RequestUpdate {

                                Durum = state,

                                Gorulme = true,
                                TamamlanmaVakti = DateTime.Now,
                                YapilanIs = up.pesrsonelRaporu.Text,
                                CagriIlgilenen = up.sicil,
                                Id = conv

                            });



                            up.RequestListTable.ReloadData ();
                        });
                    })).Start ();

                };

0 个答案:

没有答案