如果我设置了displaysSearchBarInNavigationBar = YES
在viewDidLoad
搜索栏将在导航栏时,视图显示出来.但是当我触摸栏按钮项目时,我想在导航栏顶部显示搜索栏.这就像下图
普通导航栏:
单击右侧栏按钮项后,在导航栏顶部的
搜索栏
我有一个iOS项目,我有一些更改没有提交.我点击错误地丢弃所有更改.我实际上只想丢弃特定文件的更改.但是我点击了错误的按钮.现在一切都消失了.如何撤消更改?
git status没有显示任何内容.
我正在制作一个cocoapods.我正在使用pod lib create MyLibrary
创建一个新的cocoapods.完成后,我将两个文件添加到MyLibrary/Pod/Classes /中.我提交并添加一个标签然后推送到原始主人.并且MyLibrary.podspec通过了验证.所以,我进入我创建的示例文件夹pod lib create MyLibrary
.并pod install
在终端做一个.但我收到错误:
Analyzing dependencies
Fetching podspec for `MyLibrary` from `../`
[!] Unable to satisfy the following requirements:
- `MyLibrary (from `../`)` required by `Podfile`
Run Code Online (Sandbox Code Playgroud)
podspec设置都是正确的,就像这个一样s.source_files = 'Pod/Classes/*.{h,m}'
,它通过了验证.所以我认为pod spec文件没有问题.看来pod安装无法找到Pod文件夹.但它就在那里.
我是这个制作cocoapods的新手.所以,如果有任何不清楚的地方,请告诉我.我不知道我在这里做错了什么.
我正在尝试构建自定义键盘,它就像一个表情符号键盘,但键盘的数据来自json文件.在解析了这个json文件并获取数据之后,如何让自定义键盘使用它并在键盘视图中显示,就像内置的表情符号键盘一样?现在,我按照应用程序扩展键盘:自定义键盘指南,这里只有一小部分信息.有关于如何在线创建自定义表情符号键盘的任何教程或指南吗?我正在尝试的当前代码如下:
class KeyboardViewController: UIInputViewController {
override func viewDidLoad() {
super.viewDidLoad()
var error: NSError?
let yanFile = NSBundle.mainBundle().pathForResource("yan", ofType: "json")
let yanData = NSData(contentsOfFile: yanFile) as NSData
let yanDict = NSJSONSerialization.JSONObjectWithData(yanData, options: NSJSONReadingOptions.MutableContainers, error: &error) as NSDictionary
println("dict: \(yanDict)") //print nothing in console
// Perform custom UI setup here
self.nextKeyboardButton = UIButton.buttonWithType(.System) as UIButton
self.nextKeyboardButton.setTitle(NSLocalizedString("Next Keyboard", comment: "Title for 'Next Keyboard' button"), forState: .Normal)
}
}
Run Code Online (Sandbox Code Playgroud)
json如下:
{
"list":
[
{
"tag": "laugh",
"yan":
[
"o(*???)????",
"(/???/)",
"?(o???)?"
]
},
{ …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将菜单推送到嵌入式文档.但是我在餐厅里没有定义findOne.我只想将一些文件推入餐厅的菜单类别.正如您在架构中看到的那样:
var RestaurantSchema = new mongoose.Schema({
contactTelphone : String,
address : String,
branchID : String,
email : String,
restaurantName : String,
userID : String,
menuCategory : [MenuCategorySchema]
});
var MenuCategorySchema = new mongoose.Schema({
menuCategory : String,
menuCategoryAlt : String,
sequence : Number,
menus : [MenuSchema],
restaurantInfo : { type: Schema.Types.ObjectId, ref: 'Restaurant' },
});
var MenuSchema = new mongoose.Schema({
foodName : String,
foodNameAlt : String,
picName : String,
price : String,
rating : Number,
menuSequence : Number,
category : { …
Run Code Online (Sandbox Code Playgroud) 我正在制作一个自定义键盘扩展,在这个键盘中,我有另一个uitextfield作为搜索字段,所以当我在自定义键盘上输入时,我没有将文本发送到safari的文本字段或一些聊天应用程序的文本字段,我发送文本到自定义键盘中的uitextfield搜索字段,所以我可以进行一些搜索,然后当搜索结果返回时,我将搜索结果发送到safari的文本字段或一些聊天应用程序的文本字段.所以这里有一个第一响应者问题.当我将搜索文本字段设置为第一响应者,并尝试将第一个响应者设置回safari的文本字段时.它不再起作用了.问题是如何将make safari再次设置为第一响应者?在它的第一个响应者通过搜索领域采取后.
我知道如何在视图控制器中添加pull-to-refresh.但是现在情况是:我有一个UIView
&包含a UITableView
,我想在tableview的最底部拉出表视图来重新加载它的数据.
如何在其中添加pull-to-refresh UITableView
,而不是它的父视图的控制器.
当键盘被隐藏时,scrollview应该回到它的原始contentInset,但它在iOS7中不起作用.设置scrollview的contentInset时显示键盘工作但键盘隐藏时,scrollview的contentInset不能设置为插入零.代码:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:Nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasHidden:) name:UIKeyboardDidHideNotification object:nil];
}
- (void)keyboardWasShown:(NSNotification *)notif
{
CGSize keyboardSize = [[[notif userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
UIEdgeInsets contentInsets = UIEdgeInsetsMake(0, 0, keyboardSize.height, 0);
UIScrollView *scrollView = (UIScrollView *)self.view;
scrollView.contentInset = contentInsets;
scrollView.scrollIndicatorInsets = contentInsets;
CGRect rect = self.view.frame;
rect.size.height -= keyboardSize.height;
if (!CGRectContainsPoint(rect, self.wishContentField.frame.origin)) {
CGPoint point = CGPointMake(0, self.wishContentField.frame.origin.y - keyboardSize.height);
[scrollView setContentOffset:point animated:YES];
}
}
- (void)keyboardWasHidden:(NSNotification *)notif
{
UIEdgeInsets zeroInsets = UIEdgeInsetsZero;
UIScrollView …
Run Code Online (Sandbox Code Playgroud) 我在另一个文件中定义了下面的NS_ENUM:
typedef NS_ENUM (NSUInteger, LinkPlatformType){
LinkPlatformTypeEmail = 1,
LinkPlatformTypeFacebook,
LinkPlatformTypeGoogle
};
Run Code Online (Sandbox Code Playgroud)
当我尝试做一个切换案例时:
- (void)linkWithType:(LinkPlatformType)linkType {
switch (linkType) {
case LinkPlatformTypeGoogle:
break;
case LinkPlatformTypeFacebook:
break;
default:
break;
}
}
Run Code Online (Sandbox Code Playgroud)
我收到了一个构建错误:Reference to LinkPlatformTypeGoogle is ambiguous
.Reference to LinkPlatformTypeFacebook is ambiguous
.
更新:
我定义了枚举的文件定义为例如目标1,并且有一个类StoreClass导入这个define.h文件.而StoreClass.m目标成员我已经设置为多个目标:目标1和目标2.所以在我这样做之后,Reference to LinkPlatformTypeFacebook is ambiguous
出现了.这是原因吗?
我使用 Xcode 6.1 创建一个新项目,它带有一个 Tests 目标。我正在尝试使用在同一项目中的另一个演示目标中定义的类进行测试。但是我如何实现这一点(除了将类的目标成员资格设置为演示和测试目标)?
ios ×9
iphone ×3
ios8 ×2
objective-c ×2
xcode ×2
cocoapods ×1
enums ×1
git ×1
ios7 ×1
keyboard ×1
mongodb ×1
mongoose ×1
node.js ×1
swift ×1
uiscrollview ×1
uisearchbar ×1
uitableview ×1
unit-testing ×1
xctest ×1