我们知道我们应该为iphone/ipad应用提供正常尺寸的图像和@ 2x尺寸的图像.但是为一张图片提供双倍尺寸是一件无聊的事情.
我做了一些测试,如果只有@ 2x图像,如果需要,系统会自动将@ 2x图像缩小到正常尺寸.所以在这种情况下,无视网膜iphone/ipad看起来并不奇怪.
我想知道我们可以提供@ 2x图像并让系统缩小它们以获得更小的图像吗?苹果允许这样做吗?
谢谢.
编辑:
我意识到它会导致旧设备出现内存问题.
再次感谢.
我通常使用NSNotification,如下面的示例:
在viewDidLoad中:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(foo:) name:kName1 object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(bar:) name:kName2 object:nil];
Run Code Online (Sandbox Code Playgroud)
在viewDidUnload和dealloc中:
[[NSNotificationCenter defaultCenter] removeObserver:self];
Run Code Online (Sandbox Code Playgroud)
但是一位朋友告诉我,我不应该使用,[[NSNotificationCenter defaultCenter] removeObserver:self];因为它会删除所有观察者,包括超类.他建议我使用以下代码逐个删除观察者.
[[NSNotificationCenter defaultCenter] removeObserver:self name:kName1 object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kName2 object:nil];
Run Code Online (Sandbox Code Playgroud)
我检查了ASIHttpRequest库的代码(https://github.com/pokeb/asi-http-request).它遵循我朋友的建议.
我想知道我的朋友是否正确?在我看来,由于当前实例将是卸载或dealloc,超类的通知也是无用的.并且是否有任何系统UIViewController子类使用通知?
我的应用程序是一个丰富的编辑器,它使用UIWebView和HTML5的contenteditable功能.
现在,我的应用程序有一些问题来处理复制网站内容由Safari浏览我的UIWebView当网页内容有任何image.I要像HTML标签替换<img>在UIPasteboard我的一些图片.
但是,当我使用以下代码检查粘贴板时,粘贴板中没有任何图像.但从safari复制/粘贴图像到我的应用程序工作正常.
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
NSLog(@"clip board strings = %@", pasteboard.strings);
NSLog(@"clip board urls = %@", pasteboard.URLs);
NSLog(@"clip board images = %@", pasteboard.images);
Run Code Online (Sandbox Code Playgroud)
如果我从safari复制一些图像和文本然后打开我的应用程序,NSLog如下:
2012-04-20 14:53:37.558 clip board strings = (
"text"
)
2012-04-20 14:53:37.559 [46800:17903] clip board urls = (
)
2012-04-20 14:53:37.559 [46800:17903] clip board images = (null)
Run Code Online (Sandbox Code Playgroud)
我想问一下,如何从UIPasteboard获取图像信息以及如何操作它?
提前致谢.
我们的项目用于svn管理源版本.我们遇到的问题是,当xib被2人修改时,合并后几乎会发生冲突.我使用vim打开confilct文件,信息不可读,我不知道如何解决合并冲突.
以前有人遇到过这个问题吗?怎么解决?
提前致谢.
我想制作一款应用.它可以在iphone上启动网络服务器,通过wifi传输文件.
是否有可用的开源Web服务器框架?顺便说一句,我不想越狱我的iPhone.
我的UIWebView加载了一个令人满意的html内容.我想让UIWebView聚焦并在UIWebView中显示键盘.
我用[self.webview becomeFirstResponder],但它不起作用.有什么工作方法吗?
谢谢.
我在viewDidLoad方法中注册了NSNotification .
我应该注销它无论是在viewDidUnload和dealloc使用方法的代码下面?
[[NSNotificationCenter defaultCenter] removeObserver:self];
Run Code Online (Sandbox Code Playgroud)
谢谢.
苹果开发者网站上有很多WWDC 2011视频.在视频中,有一些关于xcode编码的演示.
神奇之处在于:在这些演示中,扬声器没有逐个输入示例代码.他们只是按下xcode中的一些键,然后代码存在于xcode中.
我认为这是一个很好的演示方式,所以我想知道苹果使用了什么技术.我对这个演示进行了一些研究,它不是一个简单的"cmd + z"或"cmd + shift + z"方法.
我知道我们可以使用该buttonWithType方法获取具有特定类型的UIButton.
UIButton * button = [UIButton buttonWithType:(UIButtonTypeRoundedRect)];
Run Code Online (Sandbox Code Playgroud)
今天,我随便使用UIButton的alloc/init方法创建一个UIButton:
UIButton * button = [[UIButton alloc] initWithFrame:CGRectMake(20, 300, 100, 50)];
Run Code Online (Sandbox Code Playgroud)
然后我发现没有办法改变按钮的类型.因为UIButton的buttonType属性是readonly.
在UIKit.framework中,UIButton.h:
@property(nonatomic,readonly) UIButtonType buttonType;
Run Code Online (Sandbox Code Playgroud)
我的问题是:如果我使用alloc/init创建一个UIButton,我可以更改UIButton的类型吗?如果没有,因为UIButton中没有任何init方法-initWithType,我们只能使用该+buttonWithType方法来获取自动释放UIButton.听起来有点奇怪,为什么不提供initWithType方法呢?
ios ×9
iphone ×9
ipad ×6
objective-c ×2
uiwebview ×2
animation ×1
cocoa-touch ×1
svn ×1
uibutton ×1
uiimage ×1
uipasteboard ×1
webserver ×1
wwdc ×1
xcode4 ×1
xib ×1