小编Sto*_*123的帖子

在ios7中删除TableView的最后一行时出现动画问题

删除我的(仅)部分的最后一行时,我遇到了一些问题tableView.任何其他行都可以正常工作,但如果我tableView在任何时候删除我底部的行(不仅仅是当它的最后一行),那么动画就会很奇怪而且很迟钝.它看起来不对劲.我也注意到改变动画类型并没有做任何事情.当行滑到顶部并消失时,动画始终是.将其更改为UITableViewRowAnimationFade或其他不会做任何事情.

这是我的代码

//For the edit barButtonItem in my storyboard
- (IBAction)editButtonPressed:(id)sender {
    //enter editing mode
    if ([self.editButton.title isEqualToString:@"Edit"]) {
        [self setEditing:YES animated:YES];
        self.editButton.title = @"Done";
    } else {
        [self setEditing:NO animated:YES];
        self.editButton.title = @"Edit";
    }
}

//Editing the tableView. The user can only delete rows, not add any
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewCellEditingStyleDelete;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    // If row is deleted, remove it from the list. …
Run Code Online (Sandbox Code Playgroud)

editing tableview ios

12
推荐指数
1
解决办法
7701
查看次数

动画UIView向下滑动,然后向上滑动

我想弄清楚为什么这不起作用

在我的tableViewcontroller viewDidLoad中

self.headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 5, 320,0)];

self.headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 5, 320, 0)];

self.headerLabel.textAlignment = NSTextAlignmentCenter;

self.headerLabel.text = @"text";

[self.view addSubview:self.headerView];


[self.headerView addSubview:self.headerLabel];




[UIView animateWithDuration:.5 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{

    self.headerLabel.frame = CGRectMake(0, 5, 320,15);
    self.headerView.frame  = CGRectMake(0, 5, 320,15);

} completion:^(BOOL finished) {

    [UIView animateWithDuration:.5 delay:2.0 options:UIViewAnimationOptionCurveEaseIn animations:^{

        self.headerLabel.frame = CGRectMake(0, 5, 320,0);
        self.headerView.frame  = CGRectMake(0, 5, 320,0);

    } completion:^(BOOL finished) {

    }];

}];
Run Code Online (Sandbox Code Playgroud)

如果我删除第一个动画调用的完成块中的幻灯片备份部分它的工作原理.视图正确向下滑动.但是我根本无法让它收缩.当我在完成块中包含滑动代码时,视图不会在加载时显示,我不知道为什么而且我会疯狂

animation objective-c slider ios

9
推荐指数
2
解决办法
3万
查看次数

datagridview单元格单击事件

我有一个事件,在数据网格视图中单击一个单元格,以在消息框中的单击单元格中显示数据.我将它设置为仅适用于某个列的位置,并且仅当单元格中有数据时才设置

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
    if (dataGridView1.CurrentCell.ColumnIndex.Equals(3))
        if (dataGridView1.CurrentCell != null && dataGridView1.CurrentCell.Value != null)
            MessageBox.Show(dataGridView1.CurrentCell.Value.ToString());
}
Run Code Online (Sandbox Code Playgroud)

但是,每当我单击任何列标题时,都会显示一个空白消息框.我无法弄清楚为什么,任何提示?

c# datagridview cell

7
推荐指数
1
解决办法
7万
查看次数

更新SQL命令C#

我正在尝试用C#中的程序更新数据库.

这是我的代码,它连接到数据库并尝试更新表中的dateRoomsTable.它看起来不错,但数据库中没有任何反应.

updateConnection = new System.Data.OleDb.OleDbConnection();
updateConnection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\users\spreston\documents\visual studio 2012\Projects\roomChecksProgram\roomChecksProgram\roomsBase.accdb";
updateConnection.Open();

MessageBox.Show("Connected");

string updateCommand = "UPDATE RoomsTable SET Date Checked='9/27/2012'";
updateAdapter = new OleDbDataAdapter(updateCommand, updateConnection);

updateConnection.Close();
updateConnection.Dispose();
Run Code Online (Sandbox Code Playgroud)

我不知道为什么它不起作用.在我看来,一切都在那里.

c# sql database sql-update

3
推荐指数
1
解决办法
3万
查看次数