小编yel*_*low的帖子

使用本地映像文件时清除UIWebView缓存

我使用UIWebView加载本地html,并且在Objc创建的html中有一个PNG文件.

修改PNG文件后,我在UIWebView中重新加载html,但图像不会改变.但是,如果我退出应用程序并重新打开它,图像文件将更改为新的.

我已经在Documents with Finder中检查了PNG文件,所以我确定它已被修改,但旧的仍在UIWebView中.

所以,我认为这是一个UIWebView缓存问题,我试过:

  • [[NSURLCache sharedURLCache] removeAllCachedResponses];

  • [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:url isDirectory:NO ] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:1]]; 要么 NSURLRequestReloadIgnoringCacheData

它们都不起作用,我无法更改文件名,因为PNG文件在很多地方使用(其他html和objc代码).

我也尝试过这个: some.png?r=randomNumber 但它无法显示出来.

在本地html中使用本地图像文件时,如何清除UIWebView缓存?

caching objective-c uiwebview nsdocument ios

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

如何在登录时更改Facebook iOS SDK的完成按钮颜色?

在此输入图像描述

我的应用程序使用白色UITabBarItem文本颜色和橙色UINavigationBar BarTintColor,当点击从Facebook SDK添加的登录按钮时,它将弹出一个webview进行登录.

但是topbar背景颜色总是浅灰色,如果我改变UITabBarItem颜色,其他视图都会改变,我怎样才能在Facebook登录视图中自定义按钮颜色或更改导航栏背景颜色?

customization facebook-login facebook-ios-sdk

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

警告:常量8与XXXX类型表达式的比较始终为false

ASIHTTPRequest在我的项目中使用过,但是在文件ASIDataCompressor.m行中190:

if ([inputStream streamStatus] == NSStreamEventErrorOccurred) {
        if (err) {
            *err = [NSError errorWithDomain:NetworkRequestErrorDomain code:ASICompressionError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"Compression of %@ failed because we were unable to write to the destination data file at %@",sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]];
        }
        [compressor closeStream];
        return NO;
    }
Run Code Online (Sandbox Code Playgroud)

它警告我:

警告

谁知道怎么修它?谢谢

comparison warnings objective-c nsstream asihttprequest

8
推荐指数
2
解决办法
4027
查看次数

如何自定义UIViewAnimationCurve,如CAMediaTimingFunction的functionWithControlPoints

UIViewAnimationCurve只有

  • UIViewAnimationCurveEaseInOut
  • UIViewAnimationCurveEaseIn
  • UIViewAnimationCurveEaseOut
  • UIViewAnimationCurveLinear

这些功能.

但是,我需要像UView的ExpoOut,BackInOut动画.

像ExpoOut一样 [CAMediaTimingFunction functionWithControlPoints:0.12 :0.51 :-0.4 :1];

我使用过CABasicAnimation,但它不能像UIView动画一样改变,改变视图大小时非常糟糕.

或者,你有没有更好的方法来改变像真实的视图框架,而不是像zoomin.

谢谢.

animation core-animation objective-c uiviewanimation ios

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

iOS 6.1.2 - 为什么UIAlertView不被解雇?背景仍然在屏幕上

这是我的代码:

UIAlertView *someError = [[UIAlertView alloc] initWithTitle:nil message:@"Server Error!" delegate:nil cancelButtonTitle: @"ok" otherButtonTitles: nil];
[someError show];
Run Code Online (Sandbox Code Playgroud)

当我点击确定按钮时,警报背景仍然存在,我点击屏幕,状态栏闪烁.

我找到了一些答案,但它们不起作用,我将我的代码更改为:

dispatch_async(dispatch_get_main_queue(), ^{
       UIAlertView *someError = [[UIAlertView alloc] initWithTitle:nil message:@"Server Error!" delegate:nil cancelButtonTitle: @"ok" otherButtonTitles: nil];
       [someError show];
});
Run Code Online (Sandbox Code Playgroud)

或设置代表:

dispatch_async(dispatch_get_main_queue(), ^{
       UIAlertView *someError = [[UIAlertView alloc] initWithTitle:nil message:@"Server Error!" delegate:self cancelButtonTitle: @"ok" otherButtonTitles: nil];
       [someError show];
});

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    dispatch_async(dispatch_get_main_queue(), ^{
        [alertView dismissWithClickedButtonIndex:buttonIndex animated:NO];
    });

}
Run Code Online (Sandbox Code Playgroud)

它仍然不起作用,然后我尝试:

UIAlertView *someError = [[UIAlertView alloc] initWithTitle:nil message:@"error" delegate:nil cancelButtonTitle: @"ok" otherButtonTitles: nil];
[someError …
Run Code Online (Sandbox Code Playgroud)

objective-c uialertview ios ios6

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

Objc - 如何在这样的UIView中添加视频播放器?

这个播放器只有2个按钮,播放/暂停和全屏,它看起来像一个system player,如此快速和简单.

UIWebView and HTML5在UIView里面使用过,但是UIWebView很慢,没有全屏就无法播放.

如果这个玩家是一个UIObject或一些UIView的东西,我该如何添加它?

谢谢〜

应用程序Everyday.me中的示例视频播放器

video objective-c mpmovieplayercontroller video-player

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

警告:在此块中强烈捕获$ XXX可能会导致'AFHTTPClient.m'中的保留周期

AFNetworking在我的项目中使用,但它有2个警告: 警告

完整的警告字符串是:

/AFNetworking/AFHTTPClient.m:575:38: Capturing 'operation' strongly in this block is likely to lead to a retain cycle

warnings objective-c automatic-ref-counting afnetworking

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