我想将文本垂直居中对齐UItextView.
我正在使用以下代码
UITextView *tv = object;
CGFloat topCorrect = ([tv bounds].size.height - [tv contentSize].height * [tv zoomScale])/2.0;
topCorrect = ( topCorrect < 0.0 ? 0.0 : topCorrect );
tv.contentOffset = (CGPoint){.x = 0, .y = -topCorrect}
Run Code Online (Sandbox Code Playgroud)
;
不知怎的,这在iOS 5中不起作用,因为返回的contentSize与我在iOS6中得到的不同.
任何想法为什么contentSize相同的textView在iOS 5和iOS 6中有所不同?
我试图将页脚添加到UICollectionView.
以下是我的代码,
UICollectionView通过IB添加
在viewDidLoad我注册页脚,
[mCollectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"footer"];
Run Code Online (Sandbox Code Playgroud)
并实施以下方法
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
UICollectionReusableView *reusableview = nil;
if (kind == UICollectionElementKindSectionFooter) {
UICollectionReusableView *headerView = [mCollectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"footer" forIndexPath:indexPath];
[headerView addSubview:mFooterView];
reusableview = headerView;
}
return reusableview;
}
Run Code Online (Sandbox Code Playgroud)
但我的应用程序不断崩溃,下面是日志,
***断言失败 - [UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:],/ SourceCache/UIKit/UIKit-2380.17/UICollectionView.m:2249
任何帮助表示赞赏.
谢谢.
我写了一个守护进程是MAC OS 10.8.
我将Unix可执行文件复制到启动项.
我创建了一个.plist文件,其中Label,KeepAlive标志设置为YES,progrrammArguments数组的Item0设置为/ Libray/StartupItems/updaterDaemon.
我希望这个守护进程在系统启动时以root身份运行,因此我将其复制到startupItems中,但守护进程没有启动.
请告诉我我做错了什么或者我需要做什么才能在系统/机器启动时启动和运行这个守护进程.
提前致谢.