小编Pau*_*aul的帖子

从UIImage获取CIImage(Swift)

尝试从UIImage获取CIImage以便将其用于CIFilter,但在最后一行获得以下异常:

Execution was interrupted, reason: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

import UIKit

UIGraphicsBeginImageContextWithOptions(CGSizeMake(100,100), false, 0)
let con:CGContextRef = UIGraphicsGetCurrentContext()
CGContextAddEllipseInRect(con, CGRectMake(0,0,100,100))
CGContextSetFillColorWithColor(con, UIColor.blueColor().CGColor)
CGContextFillPath(con)
let im:UIImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()

let ciimage = CIImage(image: im) // <- Exception here
Run Code Online (Sandbox Code Playgroud)

更新: 根据建议不要将CIImage实例化为变量,我重新编写了我的初始代码片段以在操场中工作:

UIGraphicsBeginImageContextWithOptions(CGSizeMake(100,100), false, 0)
let con:CGContextRef = UIGraphicsGetCurrentContext()
CGContextAddEllipseInRect(con, CGRectMake(0,0,100,100))
CGContextSetFillColorWithColor(con, UIColor.blueColor().CGColor)
CGContextFillPath(con)
let im:UIImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()

//let ciimage = CIImage(image: im) // <- this was causing an exception

let filter = CIFilter(name: "CIGaussianBlur", withInputParameters: [kCIInputRadiusKey: 10, kCIInputImageKey: CIImage(image: im)]) // …
Run Code Online (Sandbox Code Playgroud)

uikit ios swift

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

Angular 5:触发对话框的单击按钮在关闭对话框后突出显示

我注意到,触发的对话框关闭,该按钮会获得以cdk为重点的类和cdk-program-focused .如果我点击任何地方效果消失.

app.component.html [片段]

<mat-cell *matCellDef="let element">
  <span matTooltip="Delete" matTooltipPosition="right">
    <button mat-icon-button color="warn" (click)="openDeleteAssociationDialog()">
      <mat-icon>delete</mat-icon>
    </button>
  </span>
</mat-cell>
Run Code Online (Sandbox Code Playgroud)

插图

angular angular5 angular-material-5

8
推荐指数
2
解决办法
1880
查看次数

UAngular 5:*ngFor 循环中的 mat-table [dataSource],如何从数组传递数据源

在 *ngFor 循环中将数据源从数组传递到 mat-table 的方法是什么。即我使用 *ngFor 创建多个表,每个表都需要一个数据源,但是当我尝试以下操作时它不起作用:

<mat-table #table [dataSource]="dataSources[i]"> 
Run Code Online (Sandbox Code Playgroud)

而 'i' 是在 html 模板中预先定义的:

<mat-expansion-panel *ngFor="let customer of customers; let i = index"> 
Run Code Online (Sandbox Code Playgroud)

更新:

以下对我有用,我将 dataSource 添加到每个客户对象,而不是将其分开并尝试通过“i”索引访问

<mat-table #table [dataSource]="customer.dataSource"> 
Run Code Online (Sandbox Code Playgroud)

angular-material angular angular5

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