反应原生: v0.52.0
平台: iOS
我的FlatList代码:
<FlatList
horizontal
pagingEnabled={true}
showsHorizontalScrollIndicator={false}
legacyImplementation={false}
data={this.props.photos}
renderItem={item => this.renderPhoto(item)}
keyExtractor={photo => photo.id}
ItemSeparatorComponent={this.itemSeparatorComponent}
/>
Run Code Online (Sandbox Code Playgroud)
项目分隔符代码:
itemSeparatorComponent = () => {
return <View style = {
{
height: '100%',
width: 5,
backgroundColor: 'red',
}
}
/>
}
Run Code Online (Sandbox Code Playgroud)
最后是FlatList项目组件:
renderPhoto = ({ item, index }) => {
return (
<View style = {{ width: SCREEN_WIDTH, height: 'auto' }}>
<FastImage
style = { styles.photo }
resizeMode = { FastImage.resizeMode.contain }
source = {{ uri: …Run Code Online (Sandbox Code Playgroud) horizontal-scrolling react-native react-native-ios react-native-flatlist
class IndexController extends \Phalcon\Mvc\Controller
{
public function indexAction()
{
$custom = "Custom variable";
var_dump($custom);
}
}
Run Code Online (Sandbox Code Playgroud)
如何在模板中显示不使用变量的结果?
PS Echo功能的结果也被抑制.我知道这是错误的方法,但它是调试变量的快速方法.
我知道Silex方法的基础,其中所有应用程序逻辑都在一个文件中.但我的应用程序可能有20多个控制器.所以我想有一个方便的地图来管理路由器.
我的问题是搜索我能够将路由器设置为单独文件的解决方案.在最好的情况下,该文件必须是YAML类型:
# config/routing.yml
_home:
pattern: /
defaults: { _controller: MyProject\Controller\MyController::index }
Run Code Online (Sandbox Code Playgroud)
但本地人也是一个很好的案例(对我来说):
$routes = new RouteCollection();
$routes->add(
'home',
new Route('/', array('controller' => 'MyProject\Controller\MyController::index')
));
return $routes;
Run Code Online (Sandbox Code Playgroud)
第二种情况的问题是我必须为每个路由规则使用match()函数.一点也不清楚.
有什么方法可以解决这个问题?条件是我想使用现有的API Silex或Symfony2的组件.
小记:
我不使用ControllerProviderInterface我的控制器类.这是一个独立的课程.
关于Symfony 2.1的这个问题
如何编码用户密码:
$factory = $this->get('security.encoder_factory');
$user = new Acme\UserBundle\Entity\User();
$encoder = $factory->getEncoder($user);
$password = $encoder->encodePassword('ryanpass', $user->getSalt());
$user->setPassword($password);
Run Code Online (Sandbox Code Playgroud)
和基础配置:
# app/config/security.yml
security:
# ...
encoders:
Acme\UserBundle\Entity\User: sha512
Run Code Online (Sandbox Code Playgroud)
在setter模型中:
class User implements UserInterface, \Serializable
{
public function setPassword($password)
{
$this->password = $password;
}
}
Run Code Online (Sandbox Code Playgroud)
我认为加密密码的过程必须按模型处理.如何在模型中使用标准编码器工厂?
为按钮的凹凸效果制作动画的简单而常规的方法,但是在SwiftUI中却不简单。
我试图改变scale的tapGesture改性剂,但它不会有任何效果。我不知道如何制作动画链,可能是因为SwiftUI没有动画。所以我的天真做法是:
@State private var scaleValue = CGFloat(1)
...
Button(action: {
withAnimation {
self.scaleValue = 1.5
}
withAnimation {
self.scaleValue = 1.0
}
}) {
Image("button1")
.scaleEffect(self.scaleValue)
}
Run Code Online (Sandbox Code Playgroud)
显然,它不起作用,按钮图像会立即获得上一个比例值。
我的第二个想法是0.8在hold事件release发生时将标度更改为值,然后在事件发生后将标度1.2更改为,并在几毫秒后再次将标度更改为1.0。我猜想这种算法应该会产生更好的自然碰撞效果。但是我gesture在SwiftUI中找不到合适的结构来处理hold-n-release事件。
PS为了便于理解,我将描述hold-n-release算法的步骤:
1.00.81.20.1秒1.0UPD:我发现了使用动画delay修改器的简单解决方案。但是我不确定这是正确和明确的。而且它不涵盖hold-n-release问题:
@State private var scaleValue = CGFloat(1) …Run Code Online (Sandbox Code Playgroud)