小编Ham*_*mer的帖子

react-native-maps iOS 错误

尝试将 airbnb/react-native-maps 添加到我的 React Native 项目中,并按照https://github.com/airbnb/react-native-maps/blob/master/docs/installation.md 上的指南进行操作。选项1,

选项 1:Cocoapods - 与包含的 AirMapsExplorer 示例相同

Setup your Podfile like the included example/ios/Podfile then run pod install. (If you do not need GoogleMaps support for iOS, then you can probably completely skip this step.)
Open your project in xCode workspace
Drag the following folder into your project:
node_modules/react-native-maps/ios/AirMaps/
If you need GoogleMaps support also drag this folder into your project:
node_modules/react-native-maps/ios/AirGoogleMaps/
Run Code Online (Sandbox Code Playgroud)

完成后,我无法在 Xcode 中运行该项目,它给出了错误'RCTImageLoader.h' file not found.

我试过跑步rnpm …

react-native

5
推荐指数
0
解决办法
1174
查看次数

将 JSON var 从路由传递给 ejs

我在 express+EJS 中有一些代码,

1) 在 app.js 中,创建了 mongo 集合对象,

app.locals.userCollection = db.get('userData');
Run Code Online (Sandbox Code Playgroud)

2) 在 user.js express 路由文件中,我从这个数据库连接中获取数据,并希望将其传递给 EJS 进行渲染,

exports.list = function(req, res){
   req.app.locals.userCollection.find({},function(err , returnValue){
       if(returnValue.length>0){          
          res.render('user', res.locals.returnValue);
       }
       return err;
       });
Run Code Online (Sandbox Code Playgroud)

};

3)在 user.ejs 我尝试使用访问它

<div><script>
var test = <%- returnValue %>;
Run Code Online (Sandbox Code Playgroud)

它给了我 returnValue is not defined 错误。

我可以知道如果我想访问 returnValue[0].attr1,我应该在路由和 EJS 中编码什么?

问候锤子

ejs node.js express

4
推荐指数
1
解决办法
4689
查看次数

如何以编程方式更改UICollectionView footerview的高度

我遇到一个问题,在我的UICollectionView中,我需要在返回的记录为0时显示一个页脚.下面的代码似乎工作正常,当没有记录时,会显示页脚.但是,有一个问题是,当有记录时,虽然页脚被隐藏,代码LINE 1似乎没有任何效果,这意味着页脚的空白区域仍然存在.知道怎么摆脱它吗?即将页脚高度更改为0,或者在返回记录时删除页脚.

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section {
    CGSize footerSize = CGSizeMake(320, self.view.frame.size.height);
    return footerSize;
  }

- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
    UICollectionReusableView *reusableview = nil;

    if (kind == UICollectionElementKindSectionFooter) {
        reusableview = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"FooterView" forIndexPath:indexPath];
        reusableview.hidden = YES;
        if([topicArray count]>0){
            reusableview.hidden = YES;
            //reusableview.frame = CGRectMake(0, 0, 0, 0);
            CGRect newFrame = reusableview.frame;
            newFrame.size.height =0;
            reusableview.frame = newFrame; // <-------- LINE 1.
        }else{
            reusableview.hidden = NO;
            reusableview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
            UIImageView *oopsImgView =[[UIImageView …
Run Code Online (Sandbox Code Playgroud)

uicollectionview uicollectionviewlayout

4
推荐指数
1
解决办法
9114
查看次数

错误提供未在Angular 2中定义

我的Angular 2应用程序给我以下错误:

angular2-polyfills.js:138错误:提供未定义main.ts

这是我的代码:

import {bootstrap}    from 'angular2/platform/browser';
import {AppComponent} from './app';
import {ROUTER_PROVIDERS,ROUTER_DIRECTIVES} from 'angular2/router';
import {PLATFORM_DIRECTIVES} from 'angular2/core';


bootstrap(AppComponent, [provide(PLATFORM_DIRECTIVES, {useValue: [ROUTER_DIRECTIVES], multi:true})]);
Run Code Online (Sandbox Code Playgroud)

有人有什么想法吗?

angular

4
推荐指数
1
解决办法
1737
查看次数

Angular2 - 对可观察对象发送的Object中的属性值求和

在我的service.component.j中,我从http调用返回一个Student数组的observable.Student对象有一个名为age的属性,

student.ts

export class Student {
  id: number;
  name: string;
  age:number;
}
Run Code Online (Sandbox Code Playgroud)

service.componnet.js

getStudents (): Observable< Student[]> 
Run Code Online (Sandbox Code Playgroud)

在作为上述观察者的观察者的studentManagement.component.ts中,我想总结学生的年龄.我知道我可以将sum()放在源代码中(这是不太优选的,因为我还需要在页面中显示学生的其他信息,例如id,name,个别年龄.)或者从_studentList计算它.除了这两个,还有其他方式吗?

private _studentList:Student[]=[];

    .subscribe(
            returnedStudents => {
              console.log(returnedStudents);
              this._studentList = returnedStudents;
            },
            erroMsg => this._errorMessage = erroMsg
          ) 
Run Code Online (Sandbox Code Playgroud)

javascript rxjs typescript rxjs5 angular

4
推荐指数
1
解决办法
4004
查看次数

AWS Lambda 和网关 API - 使用 cloudformation 进行蓝/绿部署

使用 cloudformation 模板通过网关 API 部署 lambda 函数时,我想将使用不同阶段创建的网关 API 放在 route53 后面,以便可以使用加权流量进行蓝/绿部署。是否可以在不手动登录到控制台进行配置的情况下自动执行整个过程?

amazon-route53 blue-green-deployment aws-lambda aws-api-gateway

4
推荐指数
1
解决办法
2115
查看次数

选择Angular2的双向绑定

Angular2,在我的ts中,我有一个控制组,如何使用ngFormControl在html中进行选择的双向绑定?

form.component.ts

this._reportGeneratingForm = fb.group({
 ......

  selectedGroup: ['']
})
Run Code Online (Sandbox Code Playgroud)

form.component.html

  <select class="form-control" ????>
      <option>Day</option>
      <option>Hour</option>
      <option>week</option>
      <option>Month</option>
    </select>
Run Code Online (Sandbox Code Playgroud)

angular2-forms angular

3
推荐指数
1
解决办法
3918
查看次数

imagePickerController设置UIImageView.image不会更改显示的图像

我试图将UIImageView的图像设置为下面的UIImagePickerController的返回.我的UIImageView profileImageView在viewdidload中实例化.奇怪的是,UIImagePickerController返回的图像尚未显示在profileImageView中.最初我认为这是图像问题,所以我把它修改为SR-rewards.jpg.添加NSLog,它显示[profileImageView setImage:[UIImage imageNamed:@"SR-rewards.jpg"]]已执行,但profileImageView.image.size.height为0.然后我给它另一个拍摄使用 [profileImageView performSelectorOnMainThread:@selector(setImage:) withObject: [UIImage imageNamed:@"SR-rewards.jpg"] waitUntilDone:YES]; 它来运行它主线程.虽然图像仍未显示,但profileImageView.image.size.height更改为277.

有什么想法的原因?我该如何设置图像?

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
    [profileImageView setImage:[UIImage imageNamed:@"SR-rewards.jpg"]];//[self cropImage:smallImage];
    NSLog(@"%f" , profileImageView.image.size.height);
    [picker dismissViewControllerAnimated:YES completion:NULL];

}
Run Code Online (Sandbox Code Playgroud)

关心锤子

objective-c uiimageview uiimagepickercontroller uiimage ios

2
推荐指数
1
解决办法
1036
查看次数