我试图在横向方向的 ipad 中心显示一个 PopOver。我现在可以使用下面的代码来完成它,但它没有与故事板上链接的“popOverViewController”相关联的属性。我希望它是故事板上的一个视图,以便我能够处理和编辑它。以及能够将其大小更改为 ipad 全视图的 50% 或 75% 并且没有箭头......
请,任何事情都会有所帮助。*更新代码....现在可以设置大小。但仍然没有看到“popOverViewController”的内容。
self.popOverViewController = [[PopOverViewController alloc]init];
self.popOver = [[UIPopoverController alloc]
initWithContentViewController:self.popOverViewController];
CGSize size = CGSizeMake(400.0,300.0);
[self.popOver setPopoverContentSize:size];
CGRect rect = CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/2, 1, 1);
[self.popOver presentPopoverFromRect:rect inView:self.view permittedArrowDirections:0 animated:YES];
Run Code Online (Sandbox Code Playgroud) 我在UIcollectionView中遇到了一系列问题,我认为解决问题的方法是解决问题.
好的,所以我有一个collectionview,可以从一个非常频繁更新的类加载对象,也许每隔几秒钟.
我遇到的第一个问题; 当我选择一个单元格并突出显示它时,集合视图下方的另一个单元格也会突出显示.我的解决方案是创建一个选定单元阵列并在新阵列中运行循环以决定要突出显示的内容.
现在,重新加载collectionview时会出现问题.单元格继续保持突出显示并显示为已选中,但它们没有注册触摸,因此我无法取消选择它.
- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection: (NSInteger)section
{
return [self.deviceList count];
}
- (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView
{
return 1;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
DeviceCollectionViewCell *cell = [self.deviceCollectionView dequeueReusableCellWithReuseIdentifier:@"DeviceCell" forIndexPath:indexPath];
if([self.deviceList count] > indexPath.row)
{
cell.device = [self.deviceList objectAtIndex:indexPath.row];
}
if ([[self.deviceCollectionView indexPathsForSelectedItems] containsObject:indexPath]) {
NSLog(@"does it ever?");
// cell.backgroundColor = [UIColor blueColor];
}
for (TDDeviceParser *device in self.selectedDevices)
{
if ([cell.device.deviceTextRecord.serialNumber isEqualToString:device.deviceTextRecord.serialNumber])
{
[cell setSelected:YES];
break;
}
else
{
[cell setSelected:NO];
}
} …Run Code Online (Sandbox Code Playgroud)