目标:
在单个UIView上同时播放多个动画.
问题:据
我所知,这是不可能的.每个动画必须按顺序发生,不能重叠.
本质上,我想要一个UIView垂直动画,同时水平动画.因为我正在使用UIViewAnimationOptionRepeat,所以我无法在onCompletion中嵌套任何其他动画:这是我想要的工作,但不是:
[UIView animateWithDuration:duration
delay:kANIMATION_DELAY
options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse animations:^{
object.frame = CGRectMake(object.frame.origin.x + 40,
object.frame.origin.y,
object.frame.size.width,
object.frame.size.height);
[UIView animateWithDuration:duration
delay:kANIMATION_DELAY
options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse animations:^{
object.frame = CGRectMake(object.frame.origin.x,
object.frame.origin.y - 40,
object.frame.size.width,
object.frame.size.height);
} completion:^(BOOL finished) {
}];
} completion:^(BOOL finished) {
}];
Run Code Online (Sandbox Code Playgroud) 目标:我有一个来自其他服务的对象列表,我想将其保留在我自己的 Postgres 数据存储中。来自该其他服务的数据返回 JSON,但不包含任何 id。
当前结果:
预期结果
主题.js
const database = require('../../shared/database'); // shared db connection. This works
const {DataTypes, Model} = require('sequelize');
class Topic extends Model { }
Topic.init({
topicId: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
defaultValue: undefined,
},
title: {
type: DataTypes.STRING,
allowNull: false,
},
count: {
type: DataTypes.INTEGER,
allowNull: true,
},
}, {
sequelize: database,
});
module.exports = Topic;
Run Code Online (Sandbox Code Playgroud)
SyncAPI.js(第一次运行)- 按预期工作
const url = 'https://....'; // the remote service …Run Code Online (Sandbox Code Playgroud)