小编Gau*_*oni的帖子

Objective-C声明@property属性(非原子,复制,强,弱)

有人能详细解释给我时,我必须使用各个属性:nonatomic,copy,strong,weak,等,为申报财产,并解释每个做什么?某种例子也会很棒.我正在使用ARC.

objective-c automatic-ref-counting declared-property

288
推荐指数
4
解决办法
16万
查看次数

Storyboard中的Modal和Push segue有什么区别?

有人可以向我解释modalpushsegue 之间的确切区别是什么?

我知道当我们使用pushsegue时push会将其添加到堆栈中,所以当我们继续使用它时会不断占用内存?

有人可以告诉我这两个是如何实现的吗?

Modalsegues可以简单地创建ctrl-click并拖动到目标但是当我使用push我的应用程序崩溃时这样做.

我从一个按钮来推动UINavigationController,有一个UIViewController.

objective-c storyboard ios swift

177
推荐指数
3
解决办法
11万
查看次数

图像缩放以鼠标位置为中心

我正在用Fabric.js编写一个脚本来缩放当前鼠标位置的图像.我已经取得了一些进展,但某处出现了错误.

案例1:将鼠标放在一个位置并使用鼠标滚轮进行缩放.

结果:完美地工作,图像放大该特定像素.

案例2:在一个位置放大一点(使用鼠标滚轮放大3-5倍),然后将鼠标移动到新位置并放大.

结果:第一个点工作正常,但移动到另一个点并缩放后,图像位置不正确.

我的代码在这个小提琴:

https://jsfiddle.net/gauravsoni/y3w0yx2m/1/

我怀疑图像定位逻辑有问题:

imgInstance.set({top:imgInstance.getTop()-newMousY,left:imgInstance.getLeft()-newMousX});
Run Code Online (Sandbox Code Playgroud)

出了什么问题?

html javascript graphics canvas fabricjs

11
推荐指数
1
解决办法
1万
查看次数

如何在UITapGestureRecognizer中传递@selector中的参数?

我在我的表头视图部分中有这个:

    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(sectionHeaderTapped:)];
Run Code Online (Sandbox Code Playgroud)

我想传递方法中的节号,sectionHeaderTapped以便我可以识别哪个部分被轻拍.

我的方法实现如下所示:

-(void)sectionHeaderTapped:(NSInteger)sectionValue {
    NSLog(@"the section header is tapped ");    
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

iphone xcode selector

7
推荐指数
1
解决办法
6958
查看次数

在Cocoa OS X中的NSTableView中选择单元格时调用哪个方法?

我有一个NSTableView,我想获得单元格中的值.我只有一列,所以我只需要行号

我可以使用这个[tableView selectedRow] - 但我把它放在哪里我想把它放在一个方法中,在选择任何行时调用它.

-(void)tableViewSelectionDidChange:(NSNotification *)notification{

NSLog(@"%d",[tableViewController selectedRow]);

}
Run Code Online (Sandbox Code Playgroud)

上面的方法也不起作用我收到错误 - [NSScrollView selectedRow]:无法识别的选择器发送到实例0x100438ef0]

我想要类似iPhone tableview中可用的方法 -

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath  {
}
Run Code Online (Sandbox Code Playgroud)

xcode cocoa nstableview osx-snow-leopard

7
推荐指数
1
解决办法
9361
查看次数

在 Ant 设计文件上传中使用 customRequest

我正在使用 Axios 处理文件上传。我在显示文件上传的上传进度时遇到问题。我使用的文件上传视图是“图片卡”。

HTML

<Upload
  accept="image/*"
  customRequest={uploadImage}
  onChange={handleOnChange}
  listType="picture-card"
  fileList={defaultListOfFiles}
  className="image-upload-grid"
>
  {defaultListOfFiles.length >= 8 ? null : <div>Upload Button</div>}
</Upload>
Run Code Online (Sandbox Code Playgroud)

OnChangeHandler

const handleOnChange = ({ file, fileList, event }) => {
  console.log(file, fileList, event);
  //Using Hooks to update the state to the current filelist
  setDefaultFileList(fileList);
  //filelist - [{uid: "-1",url:'Some url to image'}]
};
Run Code Online (Sandbox Code Playgroud)

自定义请求处理程序

const uploadImage = options => {

  const { onSuccess, onError, file, onProgress } = options;

  const fmData = new FormData();
  const config = {
    headers: …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs antd ant-design-pro

7
推荐指数
1
解决办法
1万
查看次数

何时使用awakeFromNib,initWithWindow,windowDidLoad方法?

当我们必须使用这些方法时,你能解释一下吗?而且在什么样的情况下我们应该使用哪种方法?现在我测试哪些工作并使用它(是的,我是初学者)..谢谢.我正在为MAC开发.

macos xcode cocoa

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

在Angularjs中链接多个承诺

我有以下结构,需要简化它,

可恢复的service1与IndexedDB交互

function isDbExist (){
// do something , it return either reject or resolve
}

function createDB (){
// do something , it return either reject or resolve
}

function getData (){
    // do something , it return either reject or resolve
}
Run Code Online (Sandbox Code Playgroud)

在另一个service2中,我正在注入此service1并使用这些函数

function1 (){
service1.isDbExist.then(function(data){
   service1.createDB.then(function(data){
      service1.getData.then(function(data){
        referred.resolve(data);
      },function(error){
       deferred.reject(error)
      })
   },function(error){
    deferred.reject(error);
   })
},function(error){
   deferred.reject(error);
})
}
Run Code Online (Sandbox Code Playgroud)

这里的问题是代码的可读性不好,不容易调试哪个拒绝函数是哪个承诺.这是他们这样做的好方法吗?我读过有关$ q.all的内容,但这不适用于这种情况.

javascript angularjs

4
推荐指数
2
解决办法
3293
查看次数

使用JSON.stringify时输出不同

我正在使用kendo UI,但我认为这是一个普遍的问题.

基本上我正在记录一个对象,结果看起来像这样,

在此输入图像描述

然后我JSON.stringify(obj),我得到这样的输出

{"ProductID":5,"ProductName":"Cream","UnitPrice":12,"Discontinued":false,"UnitsInStock":15,"Priority":5}
Run Code Online (Sandbox Code Playgroud)

问题,有人可以说明为什么参数"脏",'uid'没有得到字符串化?如果您能够实际发布一些创建此类对象的示例,那将会很棒.

仅供参考:我的实际对象就像stringify的输出一样,传递给了剑道网格,我从其中一个剑道网格方法中获取了脏对象(基本上给出了在网格中编辑过的行集)

有什么想法与object.prototype有关.也许父属性没有得到字符串化......

javascript json

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

Angular 5 HttpClient响应标头不包含自定义标头

我在Nodejs中制作了API,登录后我x-auth在成功登录时在响应中发送了auth-token(标题).

当我从邮递员点击web服务时,我能够看到x-auth标题但不在Angular 4中

我使用的是HttpClient,而不是Http.

createClient(client:Client){
    return this.http.post(
      Config.baseUrl+'/client/login',client,{observe:'response'});
}
Run Code Online (Sandbox Code Playgroud)

然后在我的组件中

this.userService.createClient(this.signupForm.value).subscribe((data)=>{
      this.clientCreatedSuccessfully = true;
      console.log(data);
      console.log(data.headers.getAll('x-auth'));
    },(error)=>{
      this.clientExist = true;
      console.log(error);
    })
Run Code Online (Sandbox Code Playgroud)

data.headers.getAll('x-auth')返回null.

node.js angular angular4-httpclient

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

将UIPickerView添加到UITableViewCell

我想将UIPickerView添加到UITableViewCell.现在我只是得到一个黑色的窗户.有人还可以向我解释将UI对象子类化到单元格的概念,即:我们何时将我们的单元格作为委托和数据源委托?谢谢

编辑:这是我现在正在做的代码

 case 1:  {
        cell = [tableView dequeueReusableCellWithIdentifier:@"groups"];
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"groups"];
        }
            /*NSString *myGroupDetail = [_groupArray objectAtIndex:indexPath.row];
            NSLog(@"the group detail label is %@",myGroupDetail);
            cell.textLabel.text = myGroupDetail;
            */
        [cell addSubview:_groupPicker];

        break;

    }
Run Code Online (Sandbox Code Playgroud)

这些组是我想要选择器视图的部分,我从数组中获取数据. 这是我想要实现的

iphone xcode storyboard uitableview uipickerview

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

找不到PHP错误对象

我创建了显示的文本文件的名称在目录作为一个小PHP文件first.txt,second.txt,third.txt.在点击任何文件时,我收到错误"找不到对象".

这不起作用:

localhost/Applications/XAMPP/xamppfiles/htdocs/Learning/ListingFiles/first.txt

但这有效:

file:///Applications/XAMPP/xamppfiles/htdocs/Learning/ListingFiles/first.txt

你能帮我理解什么是错的吗?

这是我的代码:

<?php

$directory = '/Applications/XAMPP/xamppfiles/htdocs/Learning/ListingFiles';

if ($handle = opendir($directory.'/')){
    echo 'Looking inside'.$directory.'<br>';

    while ($file = readdir($handle)){
        if ($file != '.'&&$file != '..'){
            echo  '<a href="'.$directory.'/'.$file.'">'.$file.'</a><br>';
        }
    }
}
?>
Run Code Online (Sandbox Code Playgroud)

以下是日志文件的一些更新

  • [Thu Jul 18 01:06:57 2013] [错误] [client :: 1]文件不存在:/ Applications/XAMPP/xamppfiles/htdocs/xampp/xamppfiles
  • [Thu Jul 18 01:15:14 2013] [error] [client :: 1]文件不存在:/ Applications/XAMPP/xamppfiles/htdocs/Applications,referer:localhost/learning/ListingFiles/file.php
  • [Thu Jul 18 01:15:43 2013] [错误] [client :: 1]文件不存在:/ Applications/XAMPP/xamppfiles/htdocs/Applications,referer:localhost/learning/ListingFiles/file.php
  • [Thu Jul 18 01:17:13 2013] [错误] [client :: …

php xampp

0
推荐指数
1
解决办法
4471
查看次数