0

この url image のようにセグメント化された uitableview を挿入します。URL 画像が表示されている場合、今は uitable のすべてのデータで問題なく動作しています。

と...

テーブルを下にスクロールすると、パート 1: 画像 (URL 内) がスクロールしてパート 2 にスクロールします: セグメント化されたものが停止し、まだスクロールする場合は uitable パート 3: データがスクロールされます (上部にセグメント化されたまま)。

あなたはそれを考えていますか。ありがとう

4

1 に答える 1

2

私はそれをテストしました、それは働いています!

  1. UITableView の痛みを設定する

  2. UITableView には 2 つのセクションがあり、各セクションには 1 つの行しかありません。

  3. セクション ヘッダーを編集するときは、2 番目のセクションのみにヘッダーがあることを確認してください。2 番目のヘッダーが part2 になります。

  4. 最初のセクションの最初の行はあなたのパート1です。

  5. 2 番目のセクションの最初の行はあなたのパート 3 です。

それでおしまい : )

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
        static NSString *CellIdentifier = @"Cell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        }

        cell.textLabel.text = @"test";

        return cell;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    @try {
        UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 30)];
        switch (section) {
            case 0:
            {
                //nothing
            }
                break;
            case 1:
            {
                UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 30)];
                lbl.text = @"second";
                lbl.textColor = [UIColor blackColor];
                [containerView addSubview:lbl];
            }
                break;
        }
        return containerView;
    }
    @catch (NSException *exception) {
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 30;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 1000.0;
}
于 2012-12-06T16:41:34.790 に答える