小编iDe*_*Dev的帖子

UICollectionView:如何检测滚动何时停止

我正在使用a UICollectionView快速滚动一组缩略图.滚动结束后,我想显示当前缩略图的更大的高分辨率版本.

如何检测用户何时完成滚动?我确实实现了didEndDisplayingCell,但这只能告诉我特定单元格何时滚动; 它不会告诉我滚动动作何时实际完成.

objective-c ios ios6 uicollectionview

56
推荐指数
5
解决办法
8万
查看次数

如何在按钮中拥有图像和文本中心

我要显示TEXTIcon上一个按钮.

+----------------------------+
|          Icon TEXT         |
+----------------------------+
Run Code Online (Sandbox Code Playgroud)

我试过了

<Button 
      android:id="@+id/Button01" 
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" 
      android:paddingLeft="40dip"
      android:text="TEXT"
      android:drawableLeft="@drawable/Icon" />
Run Code Online (Sandbox Code Playgroud)

但是,TextIcon是不是在中心.根据文字大小,
我的Text尺寸会有所不同,应调整到中心位置. IconText

我该怎么办?

android

42
推荐指数
5
解决办法
4万
查看次数

将设备旋转到横向时的UICollectionViewFlowLayout大小警告

我们使用UICollectionView来显示覆盖整个屏幕的单元格(减去状态和导航栏).单元格大小设置为self.collectionView.bounds.size:

- (void)viewWillAppear:(BOOL)animated
{
    //
    // value isn't correct with the top bars until here
    //
    CGSize tmpSize = self.collectionView.bounds.size;
    _currentCellSize = CGSizeMake( (tmpSize.width), (tmpSize.height));
}

- (CGSize)collectionView:(UICollectionView *)collectionView
                  layout:(UICollectionViewLayout*)collectionViewLayout
  sizeForItemAtIndexPath:(NSIndexPath *)indexPath {

    return _currentCellSize;
}
Run Code Online (Sandbox Code Playgroud)

这为每个设备设置了正确的大小.每个单元格都定义为没有插入,并且布局没有页眉或页脚.但是,当我们从纵向旋转到横向时,我们得到以下"投诉":

the behavior of the UICollectionViewFlowLayout is not defined because:
the item height must be less that the height of the UICollectionView minus the section insets top and bottom values.
Run Code Online (Sandbox Code Playgroud)

现在我理解了这个错误,但是我们重置了单元格的大小并使用了内置旋转过渡的流程布局:

-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    //self.collectionView.bounds are still the last size...not the new …
Run Code Online (Sandbox Code Playgroud)

objective-c ios uicollectionview uicollectionviewlayout

37
推荐指数
4
解决办法
5万
查看次数

在Xcode中更改了项目名称,导致命名错误

我的旧名字由类似于此的驼峰案类型名称组成

MyApp的

然后我把它改成了

Myapp '注意A现在是非上限'

我通过单击MyApp导航器菜单中的名称并更改它来更改此项,然后出现了一个帮助框,要求我进行系统范围的更改,我单击是!

但现在当我构建这个应用程序时,它说我的应用程序的名称是:

MYAPP-TEMP-CASEINSENSITIVE,重命名

我现在想知道如何摆脱-temp-caseinsensitive-rename部分?

xcode ios xcode4 xcode4.5 xcode4.6

32
推荐指数
3
解决办法
2万
查看次数

iOS文件路径上的/ private前缀表示什么?

当我的应用程序在iPhone上运行时,我有一个错误,但是当它在模拟器上运行时却没有.我使用主目录路径的长度来提取/ Documents中文件的相对路径.不幸的是,这并不总能在iPhone上正常工作,因为前缀"/ private"正被添加到主路径中.但是,无论有没有前缀,都可以引用相同的文件.以下代码演示了这种不一致性."/ private"的目的是什么?它何时由iOS提供?

- (IBAction)testHomepath:(id)sender {
    NSFileManager *fmgr = [NSFileManager defaultManager];
    NSString  *homePath = [NSString stringWithFormat:@"%@/Documents",NSHomeDirectory()];
    NSString  *dirPath  = [homePath stringByAppendingPathComponent:@"TempDir"];
    NSURL     *dirURL   = [NSURL fileURLWithPath:dirPath];
    NSString  *filePath = [dirPath  stringByAppendingPathComponent:@"test.jpg"];
    [fmgr createDirectoryAtPath:dirPath withIntermediateDirectories:NO attributes:nil error:nil];
    [fmgr createFileAtPath:filePath contents:nil attributes:nil];
    NSArray *keys  = [[NSArray alloc] initWithObjects:NSURLNameKey,nil];
    NSArray *files = [fmgr contentsOfDirectoryAtURL:dirURL includingPropertiesForKeys:keys options:0 error:nil];
    NSURL *f1 = (files.count>0)? [files objectAtIndex:0] : 0;
    NSURL *f2 = (files.count>1)? [files objectAtIndex:1] : 0;
    bool   b0 = [fmgr fileExistsAtPath:filePath];
    bool   b1 = [fmgr …
Run Code Online (Sandbox Code Playgroud)

iphone filepath ios

30
推荐指数
3
解决办法
6711
查看次数

使用UIRefreshControl在TableView中移位的标题

我的UIRefreshController正在做一些奇怪的事情.当我下拉刷新时,tableView标头被移位.

如果我下拉它看起来不错,但如果我向下滚动表时,复习仍在工作,头被刷新控制的高度,而UITableCells是罚款和滚动头之后偏移.

http://oi49.tinypic.com/2a8hqti.jpg

http://oi46.tinypic.com/acssrb.jpg

我想避免创建一个tableViewController,所以我在viewDidLoad中执行以下操作:

_refreshControl = [[UIRefreshControl alloc] init];
[_refreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged];
[_tableView addSubview:_refreshControl];
Run Code Online (Sandbox Code Playgroud)

我在不同的视图控制器中有很多表需要这个功能.有什么方法可以避免为每个人制作一个UITableViewController吗?

万分感谢!

objective-c uitableview ios uirefreshcontrol

28
推荐指数
2
解决办法
9308
查看次数

SQL查询获取多次出现的值

我需要查询我的数据库,以显示我的表中的lastname发生三次以上的记录.示例:在我的学生表中,有3个人使用姓氏'史密斯',4个人使用'约翰逊',1个人使用'波特'.我的查询应显示具有姓氏Smith和Johnson的记录,因为这些值发生的次数大于或等于3次.

谁能指点我这个?我在考虑使用COUNT(),但我似乎无法思考如何应用它?

sql

26
推荐指数
5
解决办法
9万
查看次数

NSOperationQueue的默认值maxConcurrentOperationCount

正如标题所示,NSOperationQueue的maxConcurrentOperationCount的默认值是多少?

是否设置为1的值?

objective-c nsoperation nsoperationqueue ios

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

How to crop the image using UIBezierPath?

I want to get the image from the UIBezierpath closed path(See the image). I draw the image on the UIView using drawRect method and also draw the lines are using the drawRect method. How can I get the particular closed path image? Please help me. Thanks in advance.

This code used for draw the bezierpath.

UIBezierPath *aPath = [UIBezierPath bezierPath];
for (NSString *pointString in pointArray) {
    if ([pointArray indexOfObject:pointString] == 0)
        [aPath moveToPoint:CGPointFromString(pointString)];
    else
        [aPath addLineToPoint:CGPointFromString(pointString)];
}
[aPath closePath];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

iphone objective-c ios uibezierpath

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

拆分视图控制器必须是根视图控制器

每当我尝试以模态方式呈现UISplitViewController时,应用程序崩溃.因此,它必须始终是根视图控制器.任何人都可以证实吗?

ipad uisplitviewcontroller ios

19
推荐指数
1
解决办法
2万
查看次数