让我说我有一个UIImage我正在设置的UIButton.我想在Quicklook中查看它.但是哦不

我无法快速查看调试图像的内容.
但是我可以从LLDB做一些事情来获取图像,[getAppButton imageForState:0](好吧,如果它不是用于undoManager位,但我不能在这里或那里),但有没有办法快速查看?
我从服务器上得到一本字典
myDictionary =
{
"rank":"1",
"color":"red",
"position":"middle"
}
Run Code Online (Sandbox Code Playgroud)
现在我想在if条件下检查键"position"的值
我是这样做的
if ([[myDictionary valueForKey:@"position"] isEqualToString:@"middle"]) {
//do Some stuff
} else{
//do some other stuff
}
Run Code Online (Sandbox Code Playgroud)
但数据类型[myDictionary valueForKey:@"position"]是_NSCFString,所以它没有正确地比较值,如果循环甚至值是正确的,也永远不会进入.
如何将其转换为NSString我可以在条件下进行比较?
我见过这些问题..
从这些问题我刚才知道它
NSString实际上是不同类型的字符串对象的容器类.通常,NSString构造函数确实返回一个实际类型的对象NSCFString,它是Core Foundation周围的一个薄包装器CFString struct.
但他们并没有帮助我..没有人真正告诉如何转换成NSString,所以请不要将其标记为重复.
我实现UITableView的UIImageView细胞,其中的每一个通过周期性地刷新本身每5秒NSTimer.每个图像都是从后台线程中的服务器加载的,并且从后台线程我还通过调用更新UI,显示新图像performSelectorOnMainThread.到现在为止还挺好.
我注意到的问题是线程数随着时间的推移而增加,UI变得无响应.因此,我想NSTimer在一个单元格离开屏幕时无效.UITableView我应该使用哪种委派方法来有效地执行此操作?
之所以我将NSTimer每个单元格关联起来是因为我不希望所有单元格同时发生图像转换.顺便说一句,有没有其他方法可以做到这一点?例如,是否可以只使用一个NSTimer?
(我无法使用,SDWebImage因为我的要求是在从服务器加载的循环中显示一组图像)
//在MyViewController.m中
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
...
NSTimer* timer=[NSTimer scheduledTimerWithTimeInterval:ANIMATION_SCHEDULED_AT_TIME_INTERVAL
target:self
selector:@selector(updateImageInBackground:)
userInfo:cell.imageView
repeats:YES];
...
}
- (void) updateImageInBackground:(NSTimer*)aTimer
{
[self performSelectorInBackground:@selector(updateImage:)
withObject:[aTimer userInfo]];
}
- (void) updateImage:(AnimatedImageView*)animatedImageView
{
@autoreleasepool {
[animatedImageView refresh];
}
}
Run Code Online (Sandbox Code Playgroud)
//在AnimatedImageView.m中
-(void)refresh
{
if(self.currentIndex>=self.urls.count)
self.currentIndex=0;
ASIHTTPRequest *request=[[ASIHTTPRequest alloc] initWithURL:[self.urls objectAtIndex:self.currentIndex]];
[request startSynchronous];
UIImage *image = [UIImage imageWithData:[request responseData]];
// How do …Run Code Online (Sandbox Code Playgroud) 我尝试打开我的应用程序,如果从safari浏览器安装在iPhone中,只需传递,myApp:// using javascript document.location="myApp://";如果没有重定向到另一个网页,以显示应用程序详细信息.但是当app没有安装safari时抛出"无法打开页面"警报,如果重定向到另一个网页那个时候也会自动提醒警报框.如果应用程序没有安装在设备上,任何人都可以帮助我如何在没有safari的情况下重定向网页无法打开页面警报.
我的代码:简单地onload="checkdevice();return false;"
用textarea中的html文件和正文显示消息"document.getElementById('txtMsg').value"
function checkdevice() Check browser detection
{
if((navigator.userAgent.match(/iPhone/)) || (navigator.userAgent.match(/iPad/)) || (navigator.userAgent.match(/iPod/)))
{
document.getElementById('txtMsg').value ="Running on iPhone /iPod /iPad Device";
checkAppExists();
return true;
}
else
{
document.getElementById('txtMsg').value ="Please run this page on iPhone / iPod / iPad Device";
checkAppExists();
return false;
}
}
function checkAppExists()
{
var time = (new Date()).getTime();
window.location="myApp://";
setTimeout(function(){
var now = (new Date()).getTime();
if((now-time)< 400)
{
window.location="http://mydomin.com/appdetails.html";
}
else
{
document.getElementById('txtMsg').value ="App Installed"; …Run Code Online (Sandbox Code Playgroud) 我可以drawRect使用外部方法绘制圆形,矩形,线条等形状
CGContextRef contextRef = UIGraphicsGetCurrentContext();
Run Code Online (Sandbox Code Playgroud)
或者drawRect仅在内部使用它是强制性的.请帮帮我,让我知道如何在drawRect方法外绘制形状.实际上我想继续在touchesMoved事件上绘制点.
这是我绘制点的代码.
CGContextRef contextRef = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(contextRef, 0, 255, 0, 1);
CGContextFillEllipseInRect(contextRef, CGRectMake(theMovedPoint.x, theMovedPoint.y, 8, 8));
Run Code Online (Sandbox Code Playgroud) 我有一个UIViewController带UIView内的容器.我在屏幕上显示广告时会调整该容器的大小,以说明广告在屏幕上占用的差异.问题是视图会调整大小,然后立即更改回来.我现在尝试了多件事但没有成功.
我已经努力在viewDidLoad方法中调整容器视图的大小,但它没有做任何事情.我也试过设置self.view.autoresizesSubviews = NO;我的目标是让视图以与我的广告动画到屏幕上的方法相同的方式设置尺寸更改动画.不管我做什么,尺寸变化都不会停留.
我用来设置框架的代码:
CGRect rectFrame = CGRectMake(self.tableViewController.frame.origin.x,
self.tableViewController.frame.origin.y,
self.tableViewController.frame.size.width,
self.tableViewController.frame.size.height - 300);
self.tableViewController.frame = rectFrame;
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用iOS上的3des加密一些必须与java和.NET的结果相匹配的东西.
Java代码是:
public class EncryptionHelper {
// Encrypts string and encode in Base64
public static String encryptText(String plainText,String key, String IV) throws Exception {
// ---- Use specified 3DES key and IV from other source --------------
byte[] plaintext = plainText.getBytes();//input
byte[] tdesKeyData = key.getBytes();// your encryption key
byte[] myIV = IV.getBytes();// initialization vector
Cipher c3des = Cipher.getInstance("DESede/CBC/PKCS5Padding");
SecretKeySpec myKey = new SecretKeySpec(tdesKeyData, "DESede");
IvParameterSpec ivspec = new IvParameterSpec(myIV);
c3des.init(Cipher.ENCRYPT_MODE, myKey, ivspec);
byte[] cipherText = c3des.doFinal(plaintext);
String encryptedString = Base64.encodeToString(cipherText,
Base64.DEFAULT); …Run Code Online (Sandbox Code Playgroud) 请使用以下代码:
[[[Resource alloc] init] get:@"/api/v1/basic_user/40/" params:nil completion:^(NSURLResponse *response, NSDictionary *data, NSError *connectionError) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
HomeViewController *homeView = [storyboard instantiateViewControllerWithIdentifier:@"HomeViewController"];
NSLog(@"pushing...");
[self.navigationController pushViewController:homeView animated:YES];
}];
Run Code Online (Sandbox Code Playgroud)
这打印出"推",在我HomeViewController出现约10(不精确)秒后.将initWithCoder(在视图控制器从故事板实例化),绝对没有.在推送我的VC之后,这就被调用了.
但我的viewDidLoad方法需要几秒钟才能加载.我不知道多少秒,因为它不准确.它有时根本不加载!(例如,我HomeViewController没有出现.
这是比较棘手的部分.如果我将推送方法移到我的块之外,一切都像魅力一样.
这是怎么回事?为什么我的VC在块里面这么慢?
编辑:
调用我的资源中的方法时,唯一使用线程的是下面的代码:
[NSURLConnection sendAsynchronousRequest:_request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError){
NSLog(@"%@", [[NSJSONSerialization JSONObjectWithData:data options:0 error:nil] description]);
[self toggleNetworkActivityIndicator];
_lastResponse = response;
success(response, data, connectionError);
}];
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Jenkins 上使用以下命令创建一个 IPA 文件
xcodebuild -exportArchive -archivePath export/MySampleApp.xcarchive -exportPath export/ -exportOptionsPlist export/export_options.plist
Run Code Online (Sandbox Code Playgroud)
但它给了我错误
+ xcodebuild -exportArchive -archivePath export/MySampleApp.xcarchive -exportPath export/ -exportOptionsPlist export/export_options.plist
2018-06-19 19:16:07.324 xcodebuild[81214:2060182] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/y5/1qdx7j6j2tdb1j6g3vvg_xww0000gn/T/MySampleApp_2018-06-19_19-16-07.323.xcdistributionlogs'.
2018-06-19 19:17:20.872 xcodebuild[81214:2060182] [MT] IDEDistribution: Step failed: <IDEDistributionPackagingStep: 0x7ff2b080be50>: Error Domain=IDEDistributionPipelineErrorDomain Code=0 "Code signing "libswiftCore.dylib" failed." UserInfo={NSLocalizedDescription=Code signing "libswiftCore.dylib" failed., NSLocalizedRecoverySuggestion=View distribution logs for more information.}
error: exportArchive: Code signing "libswiftCore.dylib" failed.
Error Domain=IDEDistributionPipelineErrorDomain Code=0 "Code signing "libswiftCore.dylib" failed." UserInfo={NSLocalizedDescription=Code signing "libswiftCore.dylib" failed., NSLocalizedRecoverySuggestion=View distribution …Run Code Online (Sandbox Code Playgroud) 我MBProgressHUD用来显示HUD,但没有按预期显示.
步骤:用户选择一个单元格tableView.解析一些数据然后UIAlertView向用户显示warning().询问用户是否要与所选(单元)用户一起创建新游戏.取消/开始游戏按钮.
该UIAlertView委托方法如下:
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog(@"button %i",buttonIndex);
if (buttonIndex == 0) {
// Cancel button pressed
self.gameNewOpponentuser = nil;
} else {
// Start Game button pressed
[MESGameModel createNewGameWithUser:[PFUser currentUser] against:self.gameNewOpponentuser];
}
}
Run Code Online (Sandbox Code Playgroud)
如果用户选择"开始游戏",GameModel则运行该方法.游戏模型(NSObject子类)方法如下:
+(void)createNewGameWithUser:(PFUser *)user1 against:(PFUser *)user2 {
// First we put a HUD up for the user on the window
MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithWindow:[UIApplication …Run Code Online (Sandbox Code Playgroud) ios ×10
objective-c ×4
iphone ×3
xcode ×2
.net ×1
android ×1
cgcontextref ×1
drawrect ×1
ios5 ×1
ipad ×1
jenkins ×1
lldb ×1
macos ×1
nscfstring ×1
nsstring ×1
nstimer ×1
quicklook ×1
safari ×1
shell ×1
uitableview ×1
uiview ×1
url-scheme ×1