所以我想知道如何将我的应用程序中的搜索栏(当前显示在导航栏下方)移动到导航栏中。
现在,我有一个名为 makeSearchBar() 的函数,我在 viewDidLoad() 中调用它来制作搜索栏。没有故事板或 xib 文件。我想去掉导航栏上的标题,用搜索栏代替。但是,当我使用其他用户问题中给出的方法时,搜索栏要么消失了,要么保持在原处。
这是搜索栏的代码:
override func viewDidLoad() {
super.viewDidLoad()
makeSearchBar()
}
func makeSearchBar() {
searchBar = UISearchBar()
searchBar.delegate = self
searchBar.frame = CGRect(x: 0, y: 0, width: screenSize.width, height: 60)
// searchBar.sizeToFit()
//TRYING TO ADD TO NAV BAR
navigationItem.titleView = searchBar
searchBar.placeholder = "Search"
view.addSubview(searchBar)
}
Run Code Online (Sandbox Code Playgroud)
我还想知道如何使应该使电池信息具有不同背景颜色的顶行。
如果您有任何建议,我很乐意听取他们的意见。我是 iOS 新手,不确定自己在做什么。
我正在尝试在具有多个 UIViews 的 UICollectionViewCell 上添加 Facebook Shimmer。
对于一个 UIView,使用以下代码可以正常工作:
let shimmeringView = FBShimmeringView(frame: imageView.frame)
shimmeringView.contentView = imageView
backgroundView.addSubview(shimmeringView)
shimmeringView.isShimmering = true
Run Code Online (Sandbox Code Playgroud)
backgroundView我拥有所有子视图的视图在哪里,例如imageView,labelView和其他。
当我尝试添加多个视图时,第一个视图获得正确的框架,但其他视图的宽度变为零。我在里面添加了这段代码collectionView(_:cellForItemAt:)。
let shimmeringView = FBShimmeringView(frame: imageView.frame)
shimmeringView.contentView = imageView
backgroundView.addSubview(shimmeringView)
shimmeringView.isShimmering = true
let shimmeringView = FBShimmeringView(frame: labelView.frame)
shimmeringView.contentView = labelView
backgroundView.addSubview(shimmeringView)
shimmeringView.isShimmering = true
Run Code Online (Sandbox Code Playgroud)
谁能告诉我这是否是为多个UIViews实施 Facebook Shimmer的正确方法,或者我在哪里做错了?
我是 GraphQL 的初学者。在设置服务器、连接到 mongodb 数据库并进行突变时,我在运行后收到以下错误node index.js。
GraphQLError:语法错误:无法解析意外字符“;”。
这是我的index.js...
const { GraphQLServer } = require('graphql-yoga');
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/todo');
const Todo = mongoose.model('Todo',{
text: String,
complete: Boolean
});
const typeDefs = `
type Query {
hello(name: String): String!
}
type Todo{
id: ID!
text: String!
complete: Boolean!
}
type Mutation{
createTodo(text: String!): Todo;
}
;
const resolvers = {
Query: {
hello: (_, { name }) => `Hello ${name || 'World'}`,
},
Mutation: {
createTodo: async (_, { …Run Code Online (Sandbox Code Playgroud) 我正在尝试从 RStudio 迁移到 emacs ess,现在我正在尝试在 emacs ess 中找到类似于 Rstudio 的自动完成功能
对于我的问题,我将使用一个简单的 RStudio 示例,如果您能告诉我如何在 emacs ess 中执行相同的操作,我将不胜感激(目的当然是概括):
在RStudio
当我输入文本
libr然后按 TAB 时我得到library()
括号内
当我像这样输入“tidyv”时:
library(tidyv)然后按 TAB 键我得到library(tidyverse)
您能否以简单的逐步方式描述我如何在 emacs ess 中执行相同的操作?
谢谢
拉斐尔
我最近在我的 Windows PC 上启动了一个项目,我希望能够在我的 Mac 上使用它。我和我的朋友正在一起学习 Git。
我无法找到您在 macOS Visual Studio 上更改分支的位置。
图为:macOS 上的“版本控制”菜单:
我错过了什么吗?我应该在其他地方更换分支机构吗?
谢谢。
我正在尝试在地图上绘制轨迹(osm)。但在尖角上的空间
String points [] = routeModel.getLatlon().split("\\|");
String [] point;
ArrayList<GeoPoint> mTrace = new ArrayList<>();
for (String s : points) {
point = s.split("-");
GeoPoint gg = new
GeoPoint(Double.parseDouble(point[0]),Double.parseDouble(point[1]));
mTrace.add(gg);
}
Polyline mPolyline = new Polyline();
mPolyline.setColor(getResources().getColor(R.color.bonusColor));
mPolyline.setWidth(14.0f);
mPolyline.setPoints(mTrace);
mapView.getOverlays().add(polyline);
Run Code Online (Sandbox Code Playgroud) 我需要一个每分钟执行一次的计时器,但是我无法使用我之前使用的代码让计时器完全运行。所以我想我从根本上做错了,这与代码无关,但即使在 Visual Studio 社区 2017 中刚刚创建的控制台项目中,它也不会执行该_timer_elapsed方法。控制台立即终止,没有错误,就好像它已经执行了所有代码
using System;
using System.Timers;
namespace Test
{
class Program
{
static Timer _timer;
public static void Main(string[] args)
{
var timer = new Timer(60000);
timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
timer.Enabled = true;
_timer = timer;
}
static void _timer_Elapsed(object sender, ElapsedEventArgs e)
{
Console.WriteLine("test");
}
}
}
Run Code Online (Sandbox Code Playgroud)
我在这里错过了什么?
我试图UNUserNotification每两周触发一次,这将从未来的特定一天开始。我已经成功触发了UNTimeIntervalNotificationTrigger。但我的问题是我无法在这里设置具体的开始日期。
UNTimeIntervalNotificationTrigger* trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:(14*24*3600) repeats: YES];
request = [UNNotificationRequest requestWithIdentifier:identifier content:content trigger:trigger];
Run Code Online (Sandbox Code Playgroud)
我已经尝试过WeekdayOrdinal,UNCalendarNotificationTrigger但这并不总是适用于两周的时间。
有什么办法可以UNUserNotification从未来的特定日期开始每两周安排一次本地活动吗?