草庐IT

MyLocation-Button

全部标签

iOS : Tabbar item click again and again it is double Tab bar button item size

我实现了带有自定义图标大小的标签栏。我从stack-overflow中找到了很多解决方案,但我没有找到任何完美的解决方案来解决这个问题。问题:当我一次又一次地点击标签栏项目时,它的大小每次都会加倍。单击其他选项卡后,它的大小与原始大小相同。请参阅此问题链接:ScreenRecording我的代码:importUIKitclasscustomTabBar:UITabBarController{overridefuncviewDidLoad(){super.viewDidLoad()lettabHome2=self.tabBar.items![2]tabHome2.image=UIImag

ios - Swift:使用 NSNotification 更新 Button.setTitle 和当前 UIPageView

Swift4:我正在使用NSNotificationpost并观察两个ViewController之间的对象。我的问题是更新观察给定接收到的对象的viewController。有两件事需要更新1.按钮的setTitle,2.UIPageViewController上的当前页面。如何更新这两个东西?我今天和昨天为此工作了一整天,但没有任何结果。我试过使用struct来做更新和普通变量。**YellowViewController-Observes->Issuehere**letsearchedReturnedKey="Searched"classYellowViewController:

ios - Swift 准备 Segue : How to know If a button or a table row initiated Segue

这是我的代码。我正在尝试执行segue。我有一个条形按钮项目以及一个表,其中的行执行相同的segue。我想知道何时单击按钮以及何时单击特定行。以下代码适用于按钮但不适用于表格的行overridefunctableView(_tableView:UITableView,didSelectRowAtindexPath:IndexPath){activePlaceRow=indexPath.rowperformSegue(withIdentifier:"toMap",sender:nil)}overridefuncprepare(forsegue:UIStoryboardSegue,send

ios - 如何根据Button的Title将autoSize设置为UIbutton?

我有按钮。为了获得按钮的标题,我向服务器发送请求,然后设置按钮的标题。现在我需要将自动调整大小设置为此按钮。这个怎么做?我在按钮的身份检查器的换行符中设置为CharacterWrap。现在文本显示为多行,但我还需要调整按钮的大小,因为有些文本太大而有些太小。这是它在Storyboard中的样子和带有约束的约束,一切正常,我只需要调整按钮的大小。importUIKit@IBDesignableclassButtonTableViewCell:UITableViewCell{@IBInspectablevarselectedColor:UIColor=UIColor.init(red:34

ios - swift : Hide button in subview

我试图在触发函数时在subview中隐藏UIButton。我对该层次结构有多个View:vartakePhotoButton:UIButton=UIButton.buttonWithType(UIButtonType.System)asUIButtontakePhotoButton.addTarget(self,action:"takePhoto",forControlEvents:UIControlEvents.TouchUpInside)varsavePhotoButton:UIButton=UIButton.buttonWithType(UIButtonType.System)a

ios - swift 3 : Get distance of button to bottom of screen

我想在Swift3中获取按钮到屏幕底部的距离。当我查看距离(alt键)时,我可以在Storyboard中看到正确的值,但遗憾的是我无法手动计算它。我正在寻找的值与按钮​​的“垂直间距到底部布局”约束中的常量相同。view.frame.maxY-randomButton.frame.maxY给我的值(value)太高了。 最佳答案 view.frame.size.height-(button.frame.size.height+button.frame.origin.y)我觉得还行!希望对你有帮助

Swift tableview Cell label change Text by button 标签

我在tableview单元格上创建了​​一个按钮和两个标签,当单击按钮时然后更改tableview标签文本这是我的代码funcbuttonLike_ww(sender:AnyObject?){vartag:NSInteger=sender!.tag;tag_last_button_clicked=tag;//foundtableletcell=TableViewCell_trandingjive(style:UITableViewCellStyle.Default,reuseIdentifier:"Cell")cell.label_dislike.text="20"cell.label

ios - swift 2 - iOS : disable a bar button

在下面的代码中,我使用swift2创建了2个右栏按钮。此时此刻,我想做这样的事情:accountButton.disable=false但那是不可能的。禁用此栏按钮的最佳解决方案是什么?letaccountImage=UIImage(named:"account")!letsettingImage=UIImage(named:"setting")!letaccountButton=UIBarButtonItem(image:accountImage,style:.Plain,target:self,action:"didTapEditButton:")letsettingButton=

ios - Swift iOS 开发中哪个 IBAction 引用了哪个 Button?

使用Swift代码进行iOS开发的新手。以前的开发人员创建了2个按钮并使用CTRL-drag-drop技术生成IBAction方法。和按钮一样,他创建了两个标签和两个IBOutlet变量。假设他没有适本地命名每个项目、每个导出和每个Action,我如何在Xcode环境中找出哪个IBAction引用哪个按钮以及哪个IBOutlet引用哪个标签? 最佳答案 这是在xib中检查小部件操作和socket表示的另一种方法。点击IBOutlet/IBAction连接指示圆圈,它会显示一个代表的小部件路径的弹出窗口,然后点击它。它会将您导航到xi

swift - 从 XIB-file-Button 显示 ViewController - Swift

有没有办法从xib文件(自定义TableViewCell)segue到Main.storyboard中的另一个ViewController。无法像在主Storyboard中那样拖动一个segue。在我想要更改View的单元格中有一个按钮。我该如何解决?谢谢! 最佳答案 你总是可以从你的Storyboard实例化一个ViewController并在点击的按钮上呈现它:letstoryboard=UIStoryboard(name:"Main",bundle:nil)letvc=storyboard.instantiateViewCon