这是twitter的代码的一些和平...我想知道如何获得分享动作视图,就像我们进入ios堆栈照片应用程序...
@IBAction func twitterButton(sender: AnyObject) {
let image: UIImage = UIImage(named: "LaunchScreenImage.png")!
let twitterControl = SLComposeViewController(forServiceType: SLServiceTypeTwitter)
twitterControl.setInitialText("")
twitterControl.addImage(image)
let completionHandler = {(result:SLComposeViewControllerResult) -> () in
twitterControl.dismissViewControllerAnimated(true, completion: nil)
switch(result){
case SLComposeViewControllerResult.Cancelled:
print("User canceled", terminator: "")
case SLComposeViewControllerResult.Done:
print("User tweeted", terminator: "")
}
}
twitterControl.completionHandler = completionHandler
self.presentViewController(twitterControl, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud) 如何UIButton在下图(具有透明背景的"入门")按钮中使边框看起来相似?
我应该如何使用故事板或如何以编程方式实现此目的?

我正在尝试使用Vuetify,v-text-field autofocus但它只是第一次使用.关闭对话框后,它不再起作用了.
这就是我想要做的:
<v-text-field ref="focus" autofocus></v-text-field>
Run Code Online (Sandbox Code Playgroud)
谷歌搜索时我发现这是一个在某些版本中修复的错误,但他们有临时解决方案我也尝试过:
watch: {
dialog: (val) ->
if !val
debugger
requestAnimationFrame( =>
@$refs.focus.focus()
)
}
Run Code Online (Sandbox Code Playgroud)
我做错了什么或者它仍然是一个错误?设置断点我看到它在那一刻停止了.任何人都能引导我走向正确的方向吗?
我唯一的区别是我使用的是Vuex,对话框变量在Vuex存储中.对话框是getter/setter.
dialog:
get: ->
return this.$store.state.my_store.isDialogOpen
set: (value) ->
this.$store.commit('my_store/MY_MUTATION', value)
Run Code Online (Sandbox Code Playgroud) 我正在尝试将文件上传到服务器.我在我的后端代码中使用SlimFramework和PHP,它是RESTful形式.如果我通过Postman上传它,图像上传效果很好但是我无法使用Swift和Alamofire库来使用它.
在后端的路由中,我从body参数得到这样的文件:
$image = $request->getUploadedFiles();
并上传我使用:
$image->moveTo("myPath");
在Swift我有路由器,它提供.post方法和路由URL,我尝试这样:
func uploadImage(user_id: Int, image: Data, completion: @escaping (_ error: Error?, _ success: Bool)->Void) {
let parameters = [
"user_id": user_id,
"newFile": image
] as [String : Any]
Alamofire.request(Router.imageUplaod(parameters: parameters))
.validate(statusCode: 200..<300)
.responseJSON { response in
switch response.result{
case .failure(let error):
completion(error, false)
print(error)
case .success(let value):
//Registered sucesfully! let json = JSON(value)
completion(nil, true)
}//Switch case
}//Alamofire
}
Run Code Online (Sandbox Code Playgroud)
我称之为:
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let …Run Code Online (Sandbox Code Playgroud) 图中左边的一个是来自Apple的日期和时间,一个是我的应用程序之一.您可能会看到我的应用程序文本显示低于Apple的文本.哪个看起来不漂亮.怎么解决这个问题?
self.statusBarItem.image = nil
self.statusBarItem.button?.imagePosition = .NoImage
self.statusBarItem.button?.title = "Sun 5 Jun 13:35"
Run Code Online (Sandbox Code Playgroud) 我无法使用该SKTransaction对象crossFadeWithDuration.
它曾经为我完美地消除SKScene了当前的新内容SKScene,但现在它更像fadeWithDuration对象,在两个SKScenes之间留下了灰色的间隙.
我觉得最近的更新发生了这种差异,但直到现在我才注意到它.我只是用UIButton印刷机调用这个方法:
self.skView.presentScene(Puzzle1(size: (self.view?.bounds.size)!), transition: SKTransition.crossFadeWithDuration(2.0))
Run Code Online (Sandbox Code Playgroud)
有没有其他人有这个问题或知道任何解决方案/解决方法?
关闭后我遇到了很多问题,Xcode其中一个问题是Xcode Storyboard不再更新Custom Class Designables并且不显示内容.例如,我使用"SkyFloatingLabelTextField"之前完成了percclty所以我不能责怪图书馆.有什么方法可以强迫它更新吗?
我的意思是插图:
正如您所看到的,在第一张图片中我已经分配了自定义类,并且实际上textField我的viewController内部由于某种原因不再出现在Storyboard中,但可以在真实设备或模拟器上运行.
所以我能以某种方式强迫它吗?
我尝试删除类和所有运行时值,清理,构建关闭Xcode但没有任何工作.
我正在尝试将inputView背景颜色从默认的灰色更改为其他颜色,但是我看不到任何解决方案。
我有UIPickerView,当用户触摸时会打开textField,它像键盘一样位于底部inputView。我是这样实现的:myTextField.inputView = myPickerView。
由于我在inputView中使用它,因此我认为实际上必须更改其背景颜色,但不知道如何。
看起来像这样:
现在,我想更改它的背景色。
我已经尝试过:
myPickerView.setValue(0.8, forKey: "alpha")myPckerView.backgroundColor = UIColor.blueself.inputView.backgroundColor = UIColor.blue这是输出(上面有一些令人讨厌的模糊层):
我是否必须为此专门创建某种自定义键盘,或者是否有解决方法,或者Apple再次告诉您您可以做什么,而不是像机器人一样?
我正在尝试从 firebase 获取所有当前用户未读消息。问题是我onSnapshot()返回以下错误,但它在初始加载时返回我所需的值。如果添加新文档,则onSnapshot(由于该错误, ) 不会再次触发
FirebaseError:函数 Query.onSnapshot() 需要 1 到 4 个参数,但使用 0 个参数调用。
这是接收所有当前用户未读消息的辅助函数。
async getUnseenMessagesCount() {
const collectionRef = (await firestore()).collection(this.collectionPath) //chats/${user_id+second_identifier/messages}
let allMessagesCount = 0
let currentUserReadMessagesCount = 0
try {
collectionRef.onSnapshot().then(snapshot => {
allMessagesCount = snapshot.docs.length
})
collectionRef
.where('seenBy', '==', '') // compare against empty string because seenBy is userId.
.onSnapshot()
.then(snapshot => {
currentUserReadMessagesCount = snapshot.docs.length
})
} catch (error) {
console.log(error)
}
console.log(allMessagesCount)
console.log(currentUserReadMessagesCount)
console.log(allMessagesCount - currentUserReadMessagesCount)
}
Run Code Online (Sandbox Code Playgroud)
由于我想获取用户参与的所有聊天中的所有未读消息计数,因此我在 vuex …
我确实使用以下参数创建了条纹帐户:
stripe.accounts.create({
type: 'custom',
business_type: 'individual',
individual: {
email: user.email,
first_name: user.firstName,
last_name: user.lastName
},
requested_capabilities: ['card_payments', 'transfers'],
email: user.email,
tos_acceptance: {
date: Math.floor(Date.now() / 1000),
ip: user.ip
}
})
Run Code Online (Sandbox Code Playgroud)
但是,如果我尝试创建转移,则会出现以下错误:
您的目标帐户至少需要启用以下功能之一:转移、legacy_payments
这是我创建转移的方式:
stripe.transfers.create({amount, currency, destination, transfer_group})
Run Code Online (Sandbox Code Playgroud)
这看起来很奇怪,因为所需的功能设置如您所见。我不知道如何进一步调试。任何帮助表示赞赏!
swift ×7
ios ×3
javascript ×3
vue.js ×2
vuejs2 ×2
xcode ×2
alamofire ×1
firebase ×1
macos ×1
nsbutton ×1
nsstatusitem ×1
php ×1
sprite-kit ×1
statusbar ×1
uibutton ×1
uipickerview ×1
vuetify.js ×1