UIActionsheet当我使用当前代码时,如何在iPad中显示它给我这个错误:
您的应用程序已呈现样式
UIAlertController(<UIAlertController: 0x7f9ec624af70>)UIAlertControllerStyleActionSheet.在modalPresentationStyle一个UIAlertController与这种风格UIModalPresentationPopover.您必须通过警报控制器提供此弹出窗口的位置信息popoverPresentationController.你必须提供一个sourceView和sourceRect或barButtonItem.如果在显示警报控制器时不知道此信息,您可以在UIPopoverPresentationControllerDelegate方法中提供该信息-prepareForPopoverPresentation.
这在iPhone上工作得很好:
let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet)
let reminderAction = UIAlertAction(title: "Reminder", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in }
optionMenu.addAction(reminderAction)
self.presentViewController(optionMenu, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
我遇到了一些类似的问题,解决方法是:
let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet)
optionMenu.popoverPresentationController?.sourceView = self.view
optionMenu.popoverPresentationController?.sourceRect = self.view.bounds
Run Code Online (Sandbox Code Playgroud)
但它并没有对我有用,可能是因为我的ActionSheet的发件人在UItableviewCell上.
我厌倦了将AlertController的Sourceview设置为tableView的Cell,但它没有正确放置,有时它部分可见这是我试过的:
optionMenu.popoverPresentationController?.sourceView = currentCell.contentView …Run Code Online (Sandbox Code Playgroud) 我有一个logo.png尺寸为image的图像720x720,我希望将其拉伸或挤压以适合整个高度或宽度,并保留宽高比,并以一个有边界的矩形居中,top-left: 32,432并bottom-right: 607,919在另一个background.png尺寸为size的图像中居中640x960。
因此,对于上述示例,logo.png将其调整为488x488并定位在top-left: 76,432。
但是我不需要计算488x488或76,432,只想使用上面的top-left和bottom-right指定符,即让ImageMagick弄清楚。
ImageMagick可以做这样的事情吗?如果不能单独使用,是否有使用convert其他方法的脚本解决方案?
我最近实施以下描述的技术识别软件本文.但是,我的数据集还包含使用OpenNI拍摄的深度图.
我想使用深度信息来增强识别器的稳健性.我虽然在提取VFH描述符后训练了1-vs-all SVM计算弓形响应直方图(我为此任务改编了OpenCV DescriptorExtractor接口).但重点是:我如何将两者结合起来以获得更精确的结果?有人可以建议我这个策略吗?
Ps我非常想测试识别器直接向kinect显示对象(而不是像我现在正在做的那样,将裁剪的图像提供给识别器).
滚动视图:
<View style={{flex:1}}>
<ScrollView
ref={(component) => {this._scrollView = component}}
scrollEventThrottle={15}
removeClippedSubviews={true}
pagingEnabled={true}
horizontal={true}
onScroll={this._onScroll.bind(this)}>
{items}
</ScrollView>
<Text style={styles.legend}>{this.state.currentPage}/{9}</Text
</View>
Run Code Online (Sandbox Code Playgroud)
_onScroll:这个方法计算当前页号是多少
<View style={{flex:1}}>
<ScrollView
ref={(component) => {this._scrollView = component}}
scrollEventThrottle={15}
removeClippedSubviews={true}
pagingEnabled={true}
horizontal={true}
onScroll={this._onScroll.bind(this)}>
{items}
</ScrollView>
<Text style={styles.legend}>{this.state.currentPage}/{9}</Text
</View>
Run Code Online (Sandbox Code Playgroud)
我认为代码行没问题,但是当我平移到scrollView下一页时,它会向后滚动。一旦我删除 中的代码行_onScroll,问题就可以解决,但我无法计算当前页码。
我有一个dotnet核心1.0应用程序,并尝试进行Post调用,但我遇到System.Net.Http的问题.我正在使用VSCode在OSX中开发这个应用程序.
当它尝试执行Post调用时,我在控制台中收到以下错误:
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
An unhandled exception has occurred: Could not load file or assembly 'System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
System.IO.FileLoadException: Could not load file or assembly 'System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Run Code Online (Sandbox Code Playgroud)
我在依赖项列表末尾的project.json文件中添加了以下行,并在dotnet restore之后调用:
"System.Net.Http": "4.1.0"
Run Code Online (Sandbox Code Playgroud)
这些是我的使用陈述:
using System;
using …Run Code Online (Sandbox Code Playgroud) 我正在使用适用于iOS的Google登录库,当我单击"登录"按钮时,应用程序崩溃时出现以下错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'Your app must support the following URL schemes: <my bundleID>,
com.googleusercontent.apps.<my client ID>'
Run Code Online (Sandbox Code Playgroud)
我检查了我的应用程序的签名版本,以确保定义了这些URL方案,它们是.
我还添加了"google"作为每个网址方案的标识符,因为我看到了Google登录示例中的操作.
这只发生在我构建我的应用程序的签名版本并在我的手机上进行临时安装时.
通过Xcode在模拟器中运行时,甚至在通过Xcode在模拟器上运行应用程序时,都不会发生这种情况.
有谁知道怎么办?
其他可能有用的信息:
我正在使用没有cocoapods的Google登录库.
我将库包和框架拖到我的项目中.
此外,我正在使用通用配置文件,其中包含应用程序ID中的通配符,出于某种原因,当我构建应用程序的签名版本时,我的应用程序的软件包ID将更改为包含通配符.
即bundle id从com.example.app更改为com.example.*.
因此,我添加了第三个包含通配符的URL方案.
我使用Sequelize express和Node.js作为后端,我的sequelize中的一些数据需要包含到另一个表中但是其中一些数据为null所以我得到的整个结果是null.
问题:如果数据可用,我该如何返回一些数据,如果没有数据则返回另一个数据
router.get("/scheduled/:id", function(req, res, next) {
models.Order.findOne({
where: {
id: req.params.id
},
attributes: ['orderStatus', 'id', 'serviceId', 'orderDescription', 'orderScheduledDate'],
include: [{
model: models.User,
attributes: ['firstName', 'phoneNumber']
}]
}).then(function(data) {
res.status(200).send({
data: data,
serviceName: data["serviceId"]
});
});
});
Run Code Online (Sandbox Code Playgroud)
我想:如果订单没有用户并且返回订单详细信息,那么结果应该返回null,而当它为null时,结果应该返回null.
当我启用缓存时,我在我的项目中使用Smarty它似乎不起作用.我使用以下结构:
index.php - display(index.tpl)
index.tpl - {include file = $ page_center}
?module = product - $ smarty-> assign("page_center","product.tpl");
在product.php中,模板product.tpl必须加载到index.tpl的中心.当我启用缓存时,它仍然显示默认内容而不是product.tpl.禁用缓存时,它可以正常工作.启用缓存时有什么问题?
根据规范,
long setInterval(Function handler, optional long timeout, any... arguments);
Run Code Online (Sandbox Code Playgroud)
setInterval()应该接受long超时延迟.
但是,在64位Linux上,它的行为与签名的32位int相似.我没有在其他平台上测试,请尝试发表评论.
显而易见的问题是 - 为什么?
有人可以解释为什么我会立即输出这个:
let maxSigned32 = 2147483647;
let safeInt = maxSigned32 + 1;
console.log(safeInt);
console.log(Number.MAX_SAFE_INTEGER);
console.log(safeInt < Number.MAX_SAFE_INTEGER); // true
let days = Math.round(safeInt / (1000.0 * 60 * 60 * 24));
console.log(safeInt + ' ms is ~' + days + ' days');
setTimeout(() => {
console.log('I should not see this today')
}, safeInt);Run Code Online (Sandbox Code Playgroud)
我在Chrome 52和Firefox 48上得到了这个(不正确的?)结果.有趣的是,当我构建并尝试使用最新的ChakraCore时,它表现得更合理.
我有一个SASS变量,如下所示:
$surrounding-margin: 0 40px;
Run Code Online (Sandbox Code Playgroud)
我正在使用它(不相关的属性已被删除):
#content {
margin: $surrounding-margin;
& #close {
margin-right: -$surrounding-margin[1]; // If this was JS.
}
}
Run Code Online (Sandbox Code Playgroud)
显然,-$surrounding-margin[1]不行.会是什么?我需要变量的第二个值,为负数.我怎样才能做到这一点?
ios ×2
javascript ×2
swift ×2
asp.net-core ×1
caching ×1
chakra ×1
css ×1
depth ×1
express ×1
imagemagick ×1
ipad ×1
mysql ×1
node.js ×1
opencv ×1
orm ×1
php ×1
react-native ×1
sass ×1
setinterval ×1
smarty ×1
spidermonkey ×1
v8 ×1
xcode ×1