Tag: 目标C

什么是void *以及它可以指向哪些variables/对象

具体来说,它可以指向int / float等吗? 那么像NSString之类的对象呢? 任何例子将不胜感激。

如何将一个工具栏添加到故事板中的UITableViewController的底部?

在我已经使用Storyboards设置的UITableView中,我需要能够添加一个粘贴到视图底部的工具栏,它不应该滚动。 不像这个问题: LINK我不认为我可以将一个TableView子视图添加到一个普通的视图,然后只是以编程方式添加一个工具栏,因为我使用的dynamic单元格似乎更容易通过故事板集成。 现在,这是我坚持….

如何设置cornerRadius仅UIView的左下angular,右下angular和左上angular?

有没有一种方法来设置cornerRadius仅UIView的左下angular,右下angular和左上angular? 我尝试了以下,但最终导致视图消失。 下面的代码有什么问题吗? UIBezierPath *maskPath; maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:(UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(20.0, 20.0)]; CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; maskLayer.path = maskPath.CGPath; view.layer.mask = maskLayer;

ios:从iPhone / iPad的代码开启/closures飞行模式

可能重复: 以编程方式激活飞行模式? 有没有办法打开/closures飞行模式在IOS(> 4.x)的代码? 我正在寻找一些(官方)API调用… 问候,马可

ios 9 objective-c屏幕尺寸问题

我升级到ios 9和xcode 7(来自xcode 6.2),现在,当我启动我的应用程序时,会发生这种情况: 现在上面和下面都有这些黑条。 我的appDelegate是这样的: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. // self.window.backgroundColor = [UIColor whiteColor]; // [self.window makeKeyAndVisible]; _startViewController = [[StartViewController alloc] init]; _startNavigationController = [[StartNavigationController alloc] initWithRootViewController:_startViewController]; self.window.rootViewController = _startNavigationController; [self.window makeKeyAndVisible]; // Need to fix this […]

加载缓慢时,ALAsset照片库图像性能得到改善

嗨,我有一个问题,我的scrollView上显示图像。 首先我创build新的UIImageView与资产url: -(void) findLargeImage:(NSNumber*) arrayIndex { ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) { ALAssetRepresentation *rep; if([myasset defaultRepresentation] == nil) { return; } else { rep = [myasset defaultRepresentation]; } CGImageRef iref = [rep fullResolutionImage]; itemToAdd = [[UIImageView alloc] initWithFrame:CGRectMake([arrayIndex intValue]*320, 0, 320, 320)]; itemToAdd.image = [UIImage imageWithCGImage:iref]; [self.scrollView addSubview:itemToAdd]; }; ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror) { […]

在Objective-C代码中解密来自河豚的值

我收到服务器的encryption数据(BLOWFISH ALGORITHM),我必须在IOS中使用blowfishalgorithm来解密它。 你可以从这里下载我的代码: https ://www.dropbox.com/s/nswsm7des7isgd5/BlowfishTest-4.zip 我从这个任务挣扎了2天,我尝试了很多链接,发现一些有用的: Blowfish源代码 如何在iOS中实现Blowfishalgorithm http://www.codeding.com/articles/blowfish-encryption-algorithm-for-iphone 在第三个环节,我得到了ECB(我必须使用ECB进行解密)。 但是这个代码在解密之后也没有给出正确的输出。 我正在使用在线工具进行testing,并显示正确的输出: http : //www.tools4noobs.com/online_tools/decrypt/ Key = 20zE1E47BE57$51 Input value is = aed5c110d793f850521a4dd3a56a70d9 Algorithm = BLOWFISH Mode = ECB Decode the input using= Hexa output = aYzY1380188405 ( this is correct output which i want) 我得到:¹àÀhÒ¢º¹ÂÂF 这是我的代码: //Mode selected by default in nib: “ECB” NSString […]

Facebook的login给我已经授权这个应用程序没有自动返回到应用程序

我的应用程序应该实现loginFacebook的,但我已经注意到,每次我想loginFacebook告诉我你已经授权这个应用程序,问题,如果我已经授权的应用程序的Facebook应该自动返回,而无需按下按键,因为我看到在其他应用程序? 看到附加的图像

使用NSSetUncaughtExceptionHandler在Objective C中注册UncaughtExceptionHandler

我使用UncaughtExceptionHandler注册未捕获exception处理程序的代码如下,你认为会有什么潜在的问题吗? @interface AppDelegate () void myHandler(NSException * exception); @end @implementation AppDelegate void myHandler(NSException * exception) { // … } – (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSSetUncaughtExceptionHandler(&myHandler); .. 有没有可能有一个更简洁的方式来写它? 我需要使用类扩展来声明原型,以摆脱没有以前的function原型的警告。

Block_release在后台线程上取消分配UI对象

在WWDC 2010“块和大中央调度”演讲中提出的模式之一是使用嵌套的dispatch_async调用在后台线程上执行耗时的任务,然后在任务完成后更新主线程上的UI dispatch_async(backgroundQueue, ^{ // do something time consuming in background NSArray *results = ComputeBigKnarlyThingThatWouldBlockForAWhile(); // use results on the main thread dispatch_async(dispatch_get_main_queue(), ^{ [myViewController UpdateUiWithResults:results]; }); }); 由于在块内部使用了“myViewController”,它会自动得到一个“保留”,并在清理块之后得到一个“释放”。 如果块的“释放”调用是最终的释放调用(例如,用户在后台任务运行时离开视图),则调用myViewController dealloc方法 – 但是在后台线程调用它! UIKit对象不喜欢在主线程之外解除分配。 在我的情况下,UIWebView引发一个exception。 这个WWDC如何呈现模式 – 特别提到是避免UIlocking的最佳新方法 – 是如此的有缺陷? 我错过了什么吗?