Tag: listview

我怎样才能从类别表中重新加载RootViewController中列出的tableView?

我在做一个笑话应用程序。 主页是RootViewController从类别表中列出的类别列表。 数据库在用户执行更改时更新。 问题是当我回到主页时,表格没有刷新。 当我再次运行应用程序时,更改是可见的。 我试过[tableView reloadData]和[self.tableView reloadData]但没有结果。 这里代码: – (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { WhySoSeriousAppDelegate *appDelegate = (WhySoSeriousAppDelegate *)[[UIApplication sharedApplication] delegate]; return appDelegate.jokes.count; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = […]

Xamarin Forms – 所选项目的Listview将所有背景改为相同

当您select一个项目时,我发现一个错误所有的孩子背景都改变了相同的颜色。 在所有的元素中,我把属性BackgroundColor。 这只发生在iOS中 按照代码示例: XAML <ListView x:Name="ListPainel" SeparatorColor="#d2d8e2" SeparatorVisibility="Default" Margin="0" ItemsSource="{Binding ListPainel_Source}" HasUnevenRows="true" RefreshCommand="{Binding ListPainel_RefreshCommand}" IsRefreshing="{Binding ListPainel_IsRefreshing}" > </ListView> 部分ViewCell protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); dynamic temp = BindingContext; PainelDto painel = (PainelDto)temp; … if(painel.HasDetalhes) { Button detalhes = new Button() { Text="VER DETALHES", FontSize = 12, TextColor = Color.FromHex("#4482ff"), HorizontalOptions = LayoutOptions.End, VerticalOptions […]

KeyboardAvoidingView + ListView

我有一个提交表单的界面,使用ListView组件,并且该行包含TextInput组件,我想用户使用KeyboardAvoidingView来避免键盘cover TextInput中的行,但是它不工作,行不向上移动。 我的代码: render() { return ( <KeyboardAvoidingView style={styles.container} behavior='padding'> <ListView dataSource = {this.state.dataSource} renderRow = {this._renderRow.bind(this)} onEndReachedThreshold = {0} overflow = 'hidden' keyboardDismissMode = 'on-drag' removeClippedSubviews = {true} /> </KeyboardAvoidingView> ); }

反应本机ListView缓慢加载

我有一个简单的ListView似乎需要很长时间来加载它的项目。 我已经在发布模式下testing过,并且需要大约3秒来加载整个页面。 如果我设置了initialListSize={1}我可以看到它逐项build立列表项。 ListView JSX代码: <ListView dataSource={this.state.dataSource} renderRow={this.renderRow} renderSeparator={(sectionID, rowID) => <View key={`${sectionID}-${rowID}`} style={styles.separator} />} style={styles.listView} initialListSize={1} /> 和renderRow方法: renderRow(row) { // console.log ('rendering scale row: ' + row.numerator + ':' + row.denominator ); return ( <TouchableHighlight onPress={() => this.pressRow(row)} underlayColor="grey"> <View style={styles.rowContainer}> <Text style={styles.rowText}>{row.hasOwnProperty('label') ? row.label : row.numerator + ':' + row.denominator}</Text> <Text style={styles.rowText}>{row.hasOwnProperty('label') […]

当isVisible设置为true时,ListView不会更新

我试图做一个ListView与可点击的行。 当你点击一行时,它将一个子堆栈布局设置为可见性true。 这在Android中正常工作,但不是在iOS中。 也许我做错了。 我仍然是一个初学者,任何想法如何解决这个或任何其他更好的方法? 问题是,它在iOS上打开,所以可见性更改,但它不会更新单元格的高度。 例如,如果向上滚动,直到看不到已打开的单元格,然后向下滚动,单元格将在屏幕外更新。 你会看到它已经更新了高度。 我尝试使用自定义渲染器,但我不知道从哪里开始。 这是我的xaml: <?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Lisa.Excelsis.Mobile.AssessmentPage" xmlns:local="clr-namespace:Lisa.Excelsis.Mobile;assembly=Lisa.Excelsis.Mobile"> <StackLayout> <local:SpecialListView x:Name="CategoryList" ItemsSource = "{Binding Categories}" HasUnevenRows="true" RowHeight="-1" GroupDisplayBinding="{Binding Name}" IsGroupingEnabled="true"> <local:SpecialListView.ItemTemplate> <DataTemplate> <ViewCell x:Name="ObservationCell"> <ViewCell.View> <StackLayout x:Name="ObservationContainer" HorizontalOptions="FillAndExpand" Orientation="Vertical" VerticalOptions="StartAndExpand" BackgroundColor="White"> <StackLayout x:Name="Observation" HorizontalOptions="FillAndExpand" VerticalOptions="StartAndExpand" Padding="15, 10, 10, 10" BackgroundColor="White"> <StackLayout.GestureRecognizers> <TapGestureRecognizer Tapped="OpenItem"/> </StackLayout.GestureRecognizers> <Grid […]

Xamarin.Forms – 强制ListView布局重绘

我有一个HasUnevenRows = true的ListView,其中每个单元格的内容是不同的开始,但内容也可以dynamic更改(通过单击单元格中的button)。 当ListView最初加载时, 系统必须执行计算 ,以便根据其内容正确确定和绘制每个单元格的高度。 但是,当我在初始加载之后更新内容时,同样的计算显然没有完成,因为单元格的高度没有改变 – 直到我将该项目滚动到视图之外,然后返回到视图。 我怎么能强制这个相同的计算和手动重绘,而不是完全刷新ListView? 我试图在.ForceLayout()包装ListView并在框架上调用.ForceLayout() ,但没有运气。