尝试重新排序行时遇到问题UITableView.我有tableView:moveRowAtIndexPath:toIndexPath:触发的功能,但是fromIndexPath等于toIndexPath(即source == destination).我在这里看到了同样的问题:uitableview重新排序不起作用,源始终等于目标
但是解决方案是 - 使用不同的库.这不是我的变种.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
//fromIndexPath is equal to toIndexPath, so nothing is exchaned
[self.table_data exchangeObjectAtIndex:fromIndexPath.row withObjectAtIndex:toIndexPath.row];
}
Run Code Online (Sandbox Code Playgroud)
我的桌子处于可编辑模式,我已经 canMoveRowAtIndexPath:返回了YES.我没有用.怎么会?我究竟做错了什么?
当我尝试显示图像网格时,我在Windows手机上有"内存不足"异常.我玩了一点代码,认为这Grid.Children.Add给了我那个错误.
我创建了自定义类,显示灰色矩形,加载图像后,它显示图像而不是该矩形.这里是:
class ImageWIthLoader
{
private BitmapImage m_loader_bitmap;
private BitmapImage m_source_bitmap;
private Image m_image;
public Image image
{
get { return m_image; }
}
//url - url to 120x120 image; width, height = 120 both
public ImageWIthLoader(string url, int width, int height)
{
m_image = new Image();
m_loader_bitmap = new BitmapImage(new Uri("Assets/Images/image_await_background.png", Uri Kind.Relative));
m_loader_bitmap.DecodePixelWidth = width;
m_loader_bitmap.DecodePixelHeight = height;
m_image.Source = m_loader_bitmap;
m_source_bitmap = new BitmapImage(new Uri(url));
m_source_bitmap.CreateOptions = BitmapCreateOptions.None;
m_source_bitmap.ImageOpened += bitmapLoaded;
}
private void bitmapLoaded(object …Run Code Online (Sandbox Code Playgroud) 我有个问题.我正在尝试使用图像放在我的自定义UIView中心.该图像外部的部分必须透明且呈灰色.在xib中为"View"我设置了这个:
结果 - 失败.图像外的区域只是灰色,不透明.但如果我补充一下
-(void) viewDidLoad
{
self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5f];
}
Run Code Online (Sandbox Code Playgroud)
然后一切都按预期工作.尝试在xib中实现透明背景时,我做错了什么?
更新:我找到了正在进行视图呈现的代码,并且里面有alpha设置.所以我猜这就是问题所在.谢谢.很抱歉这么新手