我正在尝试对 collectionView 中的单元格重新排序,但未调用 collectionView delgate 方法。我已经正确设置了代表。
- (void)collectionView:(UICollectionView *)collectionView moveItemAtIndexPath:(NSIndexPath )sourceIndexPath toIndexPath:(NSIndexPath )destinationIndexPath
这是我的工作代码。
- (void)viewDidLoad {
[super viewDidLoad];
UILongPressGestureRecognizer *longGesture=[[UILongPressGestureRecognizer alloc] init];
[longGesture addTarget:self action:@selector(handleGesture:)];
[self.collectionView addGestureRecognizer:longGesture];
NSLog(@"The array is %@",dataArray);
self.collectionView.delegate=self;
[_collectionView reloadData];
// Do any additional setup after loading the view, typically from a nib.
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return [dataArray count];
}
// The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
MyCollectionViewCell *cell …Run Code Online (Sandbox Code Playgroud) NSData *_secretData = [strValue dataUsingEncoding:NSUTF8StringEncoding]
我正在尝试在 Xamarin iOS 中转换它。但我没有在 Xamarin iOS 中获得 dataUsingEncoding 选项