uibutton

objective c how to set exclusive touch for all UIbuttons on the whole app

只谈情不闲聊 提交于 2019-12-30 10:24:06
问题 My app has many buttons through out the application I want to set Exclusive Touch all of them together at one time. or all views in the app we can set individually by [button setExclusiveTouch:YES]; But i want to set at a time for all the buttons in the application Can we set all view exclusive touch ? any body have any idea please suggest me. 回答1: You can try this // Not tested for (UIView * button in [myView subviews]) { if([button isKindOfClass:[UIButton class]]) [((UIButton *)button)

UIBarButtonItem with UIButton as CustomView - from UIButton, how to access the UIBarButtonItem its in?

佐手、 提交于 2019-12-30 06:24:24
问题 I have a UIBarButtonItem with UIButton as custom view. The UIButton has a addTarget:action: on it. In the action I present a popover. I'm currently presenting from the sender.frame (the UIButton 's Frame) I want to Present from the UIBarButtonItem instead. How can I access the UIBarButtonItem from the UIButton ? 回答1: If you have set your UIButton as the customView of a UIBarButtonItem , or a child of the custom view, then you can walk up the view hierarchy from your button until you find the

Disable UIButton programmatically

荒凉一梦 提交于 2019-12-30 06:18:27
问题 I'm stumped at why this code isn't working. I have a login button that I want to disable when the user isn't logged in. I have a UIButton delared in my .h file like so: IBOutlet UIButton *myBtn; I've set up a referencing outlet in Interface Builder to this button. In my .m file, I've tried: [myBtn setEnabled: NO]; and myBtn.enabled = NO; But neither of these disable the button in the conditional statement I'm in. (I want to disable the login button when the user successfully logs in) I'm able

How do I replicate the iOS keyboard appearance?

不想你离开。 提交于 2019-12-30 05:20:05
问题 I have made a custom number pad keypad for my iOS app, but want it to more closely mirror the appearance of the standard keyboard. I am looking for advice on how to make a standard UIButton look and act like the standard keyboard buttons. Specifically, I need to figure out the following for the iPad and would like to do as much as possible in an xib or storyboard. The size of the buttons The color of the keyboard background (or even better, how can I determine this myself?) The background

iOS UIScrollView cancel UIButton touch on scroll

末鹿安然 提交于 2019-12-30 02:31:05
问题 I have some UIButtons within a UIScrollView, but I do not want to delay the button touches. However, as soon as the scroll view detects a drag/scroll, I want to cancel the UIButton touch and proceed with the scrolling of the UIScrollView. I have included the following... _scrollView.delaysContentTouches = NO; ...but (obviously) the button touch does not cancel when dragged. Does anyone have any suggestions as to how I can implement this functionality? 回答1: You can override this method of

Select/deselect buttons swift xcode 7

我们两清 提交于 2019-12-30 02:28:12
问题 Part way done with learning swift but I hit a small wall and yet again, I'm sure I'm just a bit new at this and an easy solution is there but I'm having trouble figuring out how to select/deselect buttons below is what I have so far and it is a button turns into a checkmark when clicked on... I've gotten that far but I need that button to deselect when clicked on again and then obviously be able to be clicked again if need be. @IBAction func buttonPressed(sender: AnyObject) { sender.setImage

UIModalTransitionStylePartialCurl causing UIButton text to animate

若如初见. 提交于 2019-12-30 01:25:06
问题 I've got a UIView that gets used in a modal view using the UIModalTransitionStylePartialCurl transition style when it appears. This UIView includes a UIButton. The odd thing is that whenever the view appears, as the primary page peels up to the top of the window the button on the modal view animates itself, with the text seeming to get typed onto the button from the center of itself. The movement of this animation is a bit distracting. Why does this happen? Is there any way to prevent it? The

善用代码片段提升开发效率

十年热恋 提交于 2019-12-29 18:31:42
一.什么是代码片段( code snippets ) 代码片段:指用来存放 程序 执行代码的一块内存区域。 诸如很多开发工具基本都集成了这一功能,可以说你在 coding 的时候经常都在使用它,或许你不知道你在使用的正是 snippet 的功能,比如你在开发工具中写代码的时候,用到 if , for , while 等循环体是,基本都不是自己把整块完整的写出来,而是通过编译器的提示自动填充剩余部分的代码。这也就是所谓的代码片段( code snippets )。 二.在 xcode 中如何使用代码片段 首先来说说我们平时在写 UI 的时候是怎么写的。 比如一个 UILabel 或者比如一个 UIButton 这都是我们在开发 UI 的时候频繁使用的基础控件,基本上每个页面都会蕴含很多这样的控件,也就意味着我们需要写很多次一样的代码。也许有人说可以把 UILabel 封装一下,但是在实际开发中,需求是各种各样的,基本上还是需要对几个通用的属性进行赋值。在这里先不讨论这个话题。想想即使是一个熟练的 coder ,敲下这片代码,或许还是需要一两分钟的时候,这前提还是需要有一双好的键盘手呐! 下面引入 code snippets 的话题。 在我们平时开发的过程中写一个 for 循环,我们只需要输入 for ,然后剩余的代码只需要根据编译器的提示进行自动填充。这样的效率是很高的呐

iOS开发之AVAudioPlayer 音频播放

回眸只為那壹抹淺笑 提交于 2019-12-28 09:53:18
要给工程中添加音频,首先要导入音频的框架 AVFoundation.framework 然后新建一个类继承于 UIViewController , 我这里就叫 FirstVC . 首先在 AppDelegate.m中 初始化根视图 1 // 2 // AppDelegate.m 3 // YinPinShiPin 4 // 5 // Created by VincentXue on 12-9-3. 6 // Copyright (c) 2012年 VincentXue. All rights reserved. 7 // 8 9 #import "AppDelegate.h" 10 #import "FirstVC.h" 11 @implementation AppDelegate 12 13 - (void)dealloc 14 { 15 [_window release]; 16 [super dealloc]; 17 } 18 19 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 20 { 21 self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen

Using Tint color on UIImageView

落花浮王杯 提交于 2019-12-28 07:58:49
问题 I have my own subclass of UIButton . I add UIImageView on it and add an image. I would like to paint it over the image with a tint color but it doesn't work. So far I have: - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor clearColor]; self.clipsToBounds = YES; self.circleView = [[UIView alloc]init]; self.circleView.backgroundColor = [UIColor whiteColor]; self.circleView.layer.borderColor = [[Color getGraySeparatorColor]CGColor