动画的UISearchBar按钮hidding [英] UISearchBar animation hidding button

查看:175
本文介绍了动画的UISearchBar按钮hidding的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在有一个的UISearchBar(连接到UISearchDisplayController),但我减少了搜索栏的宽度,以便当未选择搜索栏,我可以显示一个自定义按钮到它的权利。该按钮用于访问其他意见。

I currently have a UISearchBar (attached to a UISearchDisplayController), but I reduced the width of the search bar so I could display a custom button to its right when the search bar is not selected. The button is used to access other views.

然而,当我选择搜索栏,然后preSS取消(甚至执行搜索),并返回到普通视图,在搜索栏应与我的自定义按钮来显示,搜索栏动画,并采取所有房间的按钮,不显示。从本质上讲,搜索栏占用了屏幕的全部宽度时,我只希望它占用它的一部分。

However, when I select the search bar and then press cancel (or even perform a search) and return to the normal view, where the search bar should be displayed with my custom button, the search bar animates and takes up all the room for the button and the is not displayed. Essentially, the search bar takes up all the width of the screen when I only want it to take up a part of it.

有什么办法prevent从动画到屏幕的整个宽度的搜索栏?

Is there any way to prevent the search bar from animating to the whole width of the screen?

这是怎么定义的搜索栏的CGRect:

This is how I defined the CGRect of the search bar:

self = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 250.0f, 45.0f)]

任何帮助将是巨大的。

Any help would be great.

问候

推荐答案

在最后,这个问题的答案比我想象的简单。出于某种原因,iPhone SDK填补了搜索栏框的宽度,所以我必须不断地将其重置我希望每个用户presses取消按钮,触发searchBarCancelButtonClicked()事件时的大小。一个简单的[搜索栏SETFRAME:框架]解决它。 :)

In the end, the answer to this was simpler than I thought. For some reason the iPhone SDK fills up the width of the frame of the search bar, so I have to constantly reset it to the size I want every time the user presses the cancel button and the searchBarCancelButtonClicked() event is triggered. A simple [searchBar setFrame: frame] solved it. :)

彼得,在后的问题,您链接略有不同,我已经能够调整搜索栏我想要的,我需要的是阻止它回去全宽。谢谢虽然链接。

Peter, the problem in the post you linked was slightly different, I had already been able to resize the search bar to what I wanted, what I needed was to stop it going back to full width. Thanks for the link though.

这篇关于动画的UISearchBar按钮hidding的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆