小编Nil*_*Jha的帖子

iOS 中 CollectionView 中的单元格重新排序

我正在尝试对 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)

objective-c ios uicollectionview

5
推荐指数
1
解决办法
2130
查看次数

将 NSString 转换为 NSData Xamarin iOS

NSData *_secretData = [strValue dataUsingEncoding:NSUTF8StringEncoding]

我正在尝试在 Xamarin iOS 中转换它。但我没有在 Xamarin iOS 中获得 dataUsingEncoding 选项

xamarin.ios xamarin

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