Comments (23)
PYSearchViewController
处Client error attempting to change layout margins of a private view’
from pysearch.
iOS 13可直接获取searchBar的searchTextField,遍历不到了!暂时用这个解决吧!
if (@available(iOS 13, *)) {
_searchTextField = searchBar.searchTextField;
}
else {
for (UIView *subView in [[searchBar.subviews lastObject] subviews]) {
if ([[subView class] isSubclassOfClass:[UITextField class]]) {
UITextField *textField = (UITextField *)subView;
textField.font = [UIFont systemFontOfSize:16];
_searchTextField = textField;
break;
}
}
}
from pysearch.
@xiaohange 你那个卡死大概率不是那个constraint导致的。你先fullscreen present看看还会不会卡死。
找到原因了, 你那个修复是有效的, 卡死的原因是 IQKeyboardManager
的 bug, IQKeyboardManager 引起的 _textfieldText
无法输入, 再次表示感谢!
from pysearch.
searchTextField为空崩溃
from pysearch.
相同的问题,求修复
from pysearch.
没人维护了吗
from pysearch.
@xiaohange 麻烦能录个视频或者复现路径说下嘛 我这边测试没有发现问题
from pysearch.
更改色值应该就可以看出具体的问题了。
搜索框的UI样式,跟之前的发生了变化,圆角的弧度,光标的颜色,字体的大小。
#define HexRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
这个是设置的颜色
searchViewController.searchBarBackgroundColor = HexRGB(0x000000); searchViewController.searchSuggestionView.backgroundColor = HexRGB(0x2D2D2D); searchViewController.view.backgroundColor = HexRGB(0x2D2D2D); searchViewController.searchTextField.textColor = HexRGB(0x9B9B9B);
from pysearch.
遇到相同的问题,求修复
from pysearch.
iOS 麻烦大家有问题在这里列举反馈哈
from pysearch.
自己回复吧,在iOS13里边UISearchBar自带searchTextField,所以在PYVc的内部里边需要增加iOS13的兼容,如果不想调整的话,可以在外边进行样式的设置。
例如:
PYSearchViewController *searchViewController = [PYSearchViewController searchViewControllerWithHotSearches:strArr searchBarPlaceholder:@"搜索内容" didSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) {
}];
// 3. Set style for popular search and search history
searchViewController.hotSearchStyle = PYHotSearchStyleBorderTag;
searchViewController.searchHistoryStyle = PYHotSearchStyleDefault;
searchViewController.removeSpaceOnSearchString = NO;
if (@available(iOS 13, *)) {
NSMutableAttributedString *arrStr = [[NSMutableAttributedString alloc]initWithString:searchViewController.searchBar.searchTextField.placeholder attributes:@{NSForegroundColorAttributeName : HexRGB(0x9B9B9B) ,NSFontAttributeName:[UIFont systemFontOfSize:13]}];
searchViewController.searchBar.searchTextField.attributedPlaceholder = arrStr;
searchViewController.searchBar.searchTextField.textColor = HexRGB(0x9B9B9B);
searchViewController.searchBar.layer.cornerRadius = 15;
searchViewController.searchBar.layer.masksToBounds = YES;
searchViewController.searchBar.searchTextField.backgroundColor = HexRGB(0x000000);
searchViewController.searchBar.searchTextField.textColor = HexRGB(0x9B9B9B);
searchViewController.searchBar.searchTextField.tintColor = [UIColor whiteColor];
searchViewController.searchBar.searchTextField.font = [UIFont systemFontOfSize:13];
}
from pysearch.
iOS 13 设置searchTextField样式,会出现崩溃的问题,模态弹出的样子也注意一下。希望能够维护一下。
from pysearch.
iOS13,设置searchTextField和cancelButton崩溃,提示是nil
from pysearch.
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:searchViewController];
[self presentViewController:nav animated:YES completion:nil];
开启了联想~
上面的操作会使界面卡死, 报错如下:
[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
<NSAutoresizingMaskLayoutConstraint:0x600001ca32f0 UISearchBar:0x7f8388e4a840.(null) == 2>,
<NSLayoutConstraint:0x600001ca4c30 UISearchBar:0x7f8388e4a840.left == UIView:0x7f8388e4a6e0.left>,
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600001ca4c30 UISearchBar:0x7f8388e4a840.left == UIView:0x7f8388e4a6e0.left>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
from pysearch.
Made a possible fix in my fork xiao99xiao@243a976
from pysearch.
Made a possible fix in my fork xiao99xiao@243a976
Thanks!
from pysearch.
@xiao99xiao 我试了试你那个方法, 模拟器还是会卡到这个界面, 界面会卡死不能交互
from pysearch.
@xiaohange 你那个卡死大概率不是那个constraint导致的。你先fullscreen present看看还会不会卡死。
from pysearch.
@xiaohange 你那个卡死大概率不是那个constraint导致的。你先fullscreen present看看还会不会卡死。
找到原因了, 你那个修复是有效的, 卡死的原因是
IQKeyboardManager
的 bug, IQKeyboardManager 引起的_textfieldText
无法输入, 再次表示感谢!
我也用到了IQKeyboardManager,请问这个Bug怎么解决的?
from pysearch.
@blmyself 自己对PYSearchViewController禁用IQKeyboardManager应该就好了。
参看IQKeyboardManager的README https://github.com/hackiftekhar/IQKeyboardManager/blob/master/README.md
If IQKeyboardManager conflicts with other third-party library, then it's developer responsibility to enable/disable IQKeyboardManager when presenting/dismissing third-party library UI. Third-party libraries are not responsible to handle IQKeyboardManager.
from pysearch.
ios13崩溃遍历不到的问题可以这么样遍历
if (@available(iOS 13, *)) {
for (id subView1 in [searchBar subviews]) {
for (id subView2 in [subView1 subviews]) {
for (id subView3 in [subView2 subviews]) {
if ([subView3 isKindOfClass:[UITextField class]]) {
UITextField *textField = (UITextField *)subView3;
textField.backgroundColor = [UIColor colorWithHex:@"#F6F6F6"];
textField.font = FONT(14);
textField.layer.cornerRadius = 32/2;
textField.layer.masksToBounds = YES;
_searchTextField = textField;
break;
}
}
}
}
}else{
for (UIView *subView in [[searchBar.subviews lastObject] subviews]) {
if ([[subView class] isSubclassOfClass:[UITextField class]]) {
UITextField *textField = (UITextField *)subView;
textField.backgroundColor = [UIColor colorWithHex:@"#F6F6F6"];
textField.font = FONT(14);
textField.layer.cornerRadius = 32/2;
textField.layer.masksToBounds = YES;
_searchTextField = textField;
break;
}
}
}
from pysearch.
搜索结果详情界面需要隐藏导航栏,pop回到搜索界面搜索结果tableView发生偏移
from pysearch.
@blmyself 自己对PYSearchViewController禁用IQKeyboardManager应该就好了。
参看IQKeyboardManager的README https://github.com/hackiftekhar/IQKeyboardManager/blob/master/README.mdIf IQKeyboardManager conflicts with other third-party library, then it's developer responsibility to enable/disable IQKeyboardManager when presenting/dismissing third-party library UI. Third-party libraries are not responsible to handle IQKeyboardManager.
禁用了也还是卡死的,还有别的解决方法么?
from pysearch.
Related Issues (20)
- 键盘
- 历史搜索如何使用热门搜索的 PYHotSearchStyleRankTag 样式?
- 能否调整热门和历史记录的顺序或者位置 HOT 1
- 搜索建议返回界面消失
- 能否调整列表的frame
- 请问我想自定义searchSuggestionView的headerView HOT 1
- push返回不显示
- 为啥我键盘的搜索按钮不触发代理呀
- iOS 13闪退 pod下来的,直接presentViewController,崩溃
- searchBarPlaceholder 没有有兴趣做成动态的呢
- 点击block可以把下标也返回出来吗,因为很多可能都是模型跳转
- 现在有没有搜索结果高亮的功能?
- 搜索条可以作为tableview header 的子控件吗?不一定都放在导航拦中
- 最新版PYSearch 在 iOS14 的模拟器和 iphone 上就卡死 HOT 1
- 建议提供carthage支持
- search suggestion selection requires two taps
- UISearchBar重复约束导致 push进入时键盘弹起后马上收起 HOT 1
- iOS 14 第一次点击cell无效,第二次才好
- 无法设置导航栏返回按钮的样式
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysearch.