小编boo*_*hoo的帖子

如何使用NSFileManager删除目录及其内容

Objective C的新手.我创建了一些包含iPhone应用程序pdf文件的目录.如何使用NSFileManager删除目录及其内容?

我是否需要首先循环并删除内容?任何代码示例都将非常感激.

提前致谢.

iphone objective-c

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

iOS解雇UIAlertView正在展示另一个

我有一个Utils类,当触发某些通知时会显示UIAlertView.有没有办法在展示一个新的UIAlertViews之前将其解雇?

当我使用应用程序进入后台时,我正在这样做

[self checkViews:application.windows];
Run Code Online (Sandbox Code Playgroud)

在applicationDidEnterBackground上

- (void)checkViews:(NSArray *)subviews {
    Class AVClass = [UIAlertView class];
    Class ASClass = [UIActionSheet class];
    for (UIView * subview in subviews){
        if ([subview isKindOfClass:AVClass]){
            [(UIAlertView *)subview dismissWithClickedButtonIndex:[(UIAlertView *)subview cancelButtonIndex] animated:NO];
        } else if ([subview isKindOfClass:ASClass]){
            [(UIActionSheet *)subview dismissWithClickedButtonIndex:[(UIActionSheet *)subview cancelButtonIndex] animated:NO];
        } else {
            [self checkViews:subview.subviews];
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这使得applicationDidEnterBackground很容易,因为我可以使用application.windows

我可以使用AppDelegate或类似的东西来获取所有视图,循环它们并关闭任何UIAlertViews吗?

uialertview dismiss ios

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

iPad popover presentpopoverfrombarbuttonitem

我在导航栏的右侧添加了几个按钮,其中包含以下内容:

UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
customView.backgroundColor = [UIColor clearColor];

UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0,  0, 45, 44);
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
button.backgroundColor = [UIColor clearColor];
[button setImage:[UIImage imageNamed:@"toc.png"] forState:UIControlStateNormal];
button.userInteractionEnabled = YES;
[button addTarget:self action:@selector(tableOfContentsAction) forControlEvents:UIControlEventTouchUpInside];
[customView addSubview:button];

button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(50, 0, 45, 44);
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
button.backgroundColor = [UIColor clearColor];
[button setImage:[UIImage imageNamed:@"bookmark.png"] forState:UIControlStateNormal];
button.userInteractionEnabled = YES;
[button addTarget:self action:@selector(bookmarkButtonAction) forControlEvents:UIControlEventTouchUpInside];
[customView …
Run Code Online (Sandbox Code Playgroud)

popover ipad ios

4
推荐指数
2
解决办法
7309
查看次数

iOS CATiledLayer 崩溃

我有一个适用于 iPad 的 pdf 阅读器应用程序,我使用滚动视图来显示每个页面。我将页面保持在视图中,并在页面的任一侧查看一页。我有纵向和横向视图的单独视图。纵向视图显示单个页面,横向查看器显示 2 个页面。

当 iPad 改变方向时,我卸载旧方向的视图并加载新方向的视图。因此,假设它处于纵向视图,然后更改为横向,应用程序会卸载纵向视图并加载横向视图。这一切都很好,除非 pdf 很大。

pdf 是使用 tiledlayers 绘制的。当使用大 pdf 更改方向时,应用程序会崩溃。如果在所有图块绘制之前更改方向,应用程序只会崩溃。我的猜测是它正在崩溃,因为它试图将瓷砖绘制到一个视图而不是已卸载的视图。那么有没有办法在我卸载视图时停止绘制瓷砖?

catiledlayer ios

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

如何用PHP密码保护上传的PDF

我有一个Web应用程序,用户可以上传PDF文档.是否有可用于密码保护PDF文件的PHP库?我需要库来保留原始PDF的所有方面(即大小,字体,分辨率等).

php security passwords

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