uikit

Appearance Proxies & Layers

时间秒杀一切 提交于 2019-12-24 03:05:17
问题 Is it possible to use iOS 5 appearance proxies to refactor code that sets properties on layers? _button.layer.cornerRadius = 5.0f; _button.layer.borderWidth = 1.0f; _button.layer.borderColor = [[UIColor blackColor] CGColor]; _button.layer.masksToBounds = YES; 回答1: Nope.. Apple's says: To support appearance customization, a class must conform to the UIAppearanceContainer protocol and relevant accessor methods must be marked with UI_APPEARANCE_SELECTOR. http://developer.apple.com/library/ios/

Add buttons to UINavigationController subclass

大兔子大兔子 提交于 2019-12-24 03:04:00
问题 I'm trying to create reusable subclass of UINavigationController . So here's my code : @interface MainNavigationController : UINavigationController ... - (void)viewDidLoad { [super viewDidLoad]; self.navigationBar.barTintColor = primaryOrange; self.navigationBar.tintColor = white; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"search"] style:UIBarButtonItemStylePlain target:self action:nil]; self.navigationItem.rightBarButtonItem = [

Is the creation of an UIKit object in background using GCD a bad practice?

拈花ヽ惹草 提交于 2019-12-24 02:23:34
问题 As pointed out by bbum here, the doc says: " For the most part, UIKit classes should only be used from the main thread of an application This is especially true for derived classes UIResponder or involve the manipulation of user interface of your application in any way. ". I thought I understood that the methods of drawings could not be called in a background thread, so that the creation could be done in the background, as the drawRect method is only called when the view is added. But maybe i

How to make multiple read more buttons in same page using one jquery?

随声附和 提交于 2019-12-24 01:19:59
问题 I want to make multiple read more and read less button in same page using only one jquery . when i clicked the read more button ,it show some content and at the end of paragraph it shows read less button . I compled my 1st step . there are three readmore button in one page . One is working good but other two is not working .please give some suggestion . $(document).ready(function() { $("#toggle").click(function() { var elem = $("#toggle").text(); if (elem == "Read More") { $("#toggle").text(

Using a Timer in the background thread to update UI

↘锁芯ラ 提交于 2019-12-24 00:53:48
问题 In my app I have a timer that can be up to 5 minutes long. The user can add an element to an array which resets the timer to 5 minutes. When the timer counts town, there's also a UIView which changes its width from 100% of the view to 0% of it in proportion to the timer. I'd like to run my timer on a background thread to avoid a delay in the timer starting due to other UI events happening. Is it possible to have a timer run in a background thread whose associated function that the timer calls

Unable to disable animation of CALayer>>removeFromSuperlayer

三世轮回 提交于 2019-12-23 21:15:56
问题 I wish to remove a CALayer from its superlayer without animating. What happens here is the layer animates to a position, works great, when however the animation stopped, this code is executed, which returns the layer to its start position, and fades out; presumably then gets removed from the superlayer. How may it be stopped from animating -removeFromSuperlayer ? The code listed here has the same behavior for all variations of the included comments being uncommented and not uncommented,

UIKit SDK 3.0 error

梦想与她 提交于 2019-12-23 20:15:34
问题 I am using iphone_sdk_3.0_beta_5__9m2735 SDK. When I try to compile my code using simulator 3.0 option I get following error. The code compiles for rest all simulator option ie 2.0, 2.1, 2.2, 2.2.1 While compiling my code I get following error from /Users/videomac/manish/EXPLab/2009-05-27-11-20 myApp_LL_2/myApp_Prefix.pch:7: In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:30,

Custom init method in Objective-C, how to avoid recursion?

[亡魂溺海] 提交于 2019-12-23 20:11:46
问题 I want to create a subclass of UINavigationController which always starts with the same root controller. Nothing special, so (to me) it makes perfect sense to override the init method like this: - (id) init { rootController = [[MyController alloc] init]; if (self = [super initWithRootViewController:rootController]) { // do some more initialization } return self; } This obviously creates a problem, because [super initWithRootViewController] will call [UINavigationController init], which is of

Why does setting a UILabel to be fully transparent lose tap gestures?

跟風遠走 提交于 2019-12-23 18:13:53
问题 I can't figure this out, and I don't think this really explains it either. I have a UILabel that can be tapped by the user to hide or show it, set up like this: self.numberLabel.userInteractionEnabled = YES; UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideOrShowNumber)]; [self.numberLabel addGestureRecognizer:tapGesture]; I would like to animate the hiding and showing of the label by setting the alpha value on the UILabel . However

iPad crash with UIActionSheet displayed from child view controller

不羁的心 提交于 2019-12-23 17:46:17
问题 I apologize if this has been asked but I can't seem to find it anywhere. I even recreated my issue in a demo project in case any of you want to see it first-hand, although I don't know where I should post it. I have a xibless UINavigationController based app. Some of my child ViewControllers have a button on the right side at the top that then displays a UIActionSheet. My app is designed for iPhone and iPad, so when I get ready to display the UIActionSheet I do: UIActionSheet *actionSheet = [