我正在使用PrimeNG,但无法限制下拉值的选择。请帮忙。
成分:
import {SelectItem} from 'primeng/api';
interface City {
name: string,
code: string
}
export class MyModel {
cities1: SelectItem[];
cities2: City[];
selectedCities1: City[];
selectedCities2: City[];
constructor() {
//SelectItem API with label-value pairs
this.cities1 = [
{label:'New York', value:{id:1, name: 'New York', code: 'NY'}},
{label:'Rome', value:{id:2, name: 'Rome', code: 'RM'}},
{label:'London', value:{id:3, name: 'London', code: 'LDN'}},
{label:'Istanbul', value:{id:4, name: 'Istanbul', code: 'IST'}},
{label:'Paris', value:{id:5, name: 'Paris', code: 'PRS'}}
];
//An array of cities
this.cities2 = [
{name: 'New …Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中有一个圆形视图,我在圆形视图中移动一些像图形的对象,它在90%的情况下工作正常,但在某些情况下它没有调用TouchEnded,我的重置图代码在TouchEnded方法中,所以它在下面的某个点卸载是我的代码用于触摸委托方法.
#pragma mark - Touch Events For Rotation of GRAPH
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
UITouch* touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self.view];
prevAngle = [Utilities angleBetweenPoint:touchPoint toPoint:self.view.center];
/// convert negative angle into positive angle
if(prevAngle < 0){
prevAngle = PI_DOUBLE + prevAngle;
}
//
[_viewStaticRadialPart hideToolTip];
}
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
CGFloat diffAngle, tempCurAngle, tempPrevAngle, curTransformAngle, newTransformAngle;
NSLog(@"touchesMoved");
// Get the only touch (multipleTouchEnabled is NO)
UITouch* touch = [touches anyObject];
// Track the …Run Code Online (Sandbox Code Playgroud) 滚动我的UICollectionView. 它显示一个空白视图,其中没有任何单元格。
它奇怪地隐藏了我的手机或移除了我的手机,我不知道,但我找不到任何解决方案。
我已经尝试过这些解决方案:
第一:尝试创建自定义类UICollectionViewFlowLayout并按照所有不同的方法进行操作,但无法解决我的问题。
第二:尝试了以下方法来重新分配和重新计算我的单元格大小:
-(BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
{
return YES;
}
Run Code Online (Sandbox Code Playgroud)
我遵循的链接:
问题 2:使用我自己的 UICollectionViewFlowLayout 子类滚动时 UICollectionView 项目消失
请指导我使用自定义单元格的简单集合视图有什么问题。
参考图片:
objective-c ios uicollectionview uicollectionviewcell uicollectionviewlayout
由于我阅读了许多Firebase AdMob相关问题及其解决方案,我对我的应用程序和CocoaPod更新做了同样的事情,但仍然面临库问题并收到以下错误:
[GADMobileAds configureWithApplicationID:@"ca-app-pub-3940256099942544~1458002511"];
Run Code Online (Sandbox Code Playgroud)
错误:所选方法 configureWithApplicationID 没有未知类
问题参考: 无法在iOS项目中更新Google AdMob
尽管如此,它仍然低于 POD 的 SDK 版本
Google-移动广告-SDK (7.8.1)
虽然我在最新版本上手动强制更新,如下所示:
pod 'Google-Mobile-Ads-SDK', '~> 7.16'
Run Code Online (Sandbox Code Playgroud)
还
pod 'Google-Mobile-Ads-SDK', '~> 7.9.1'
Run Code Online (Sandbox Code Playgroud)
参考:基于 CocoaPod 网站
target 'MyApp' do pod 'Google-Mobile-Ads-SDK', '~> 7.16' end
它会给我一个错误,例如:
Run Code Online (Sandbox Code Playgroud)[!] Unable to satisfy the following requirements: - `Google-Mobile-Ads-SDK (= 7.16)` required by `Podfile` None of your spec sources contain a spec satisfying the dependency: `Google-Mobile-Ads-SDK (= 7.16)`. You have either: * out-of-date source repos which you …
我正在开发 Bot 应用程序,这里有 2 个功能
两者都按预期工作,但我想检测到当用户当时停止说话时,我想停止检测并将该数据发送到服务器。
有没有办法让那个用户不说话?
我正在使用以下代码进行语音检测:
// Starts an AVAudio Session
NSError *error;
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
[audioSession setActive:YES withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:&error];
// Starts a recognition process, in the block it logs the input or stops the audio
// process if there's an error.
recognitionRequest = [[SFSpeechAudioBufferRecognitionRequest alloc] init];
AVAudioInputNode *inputNode = audioEngine.inputNode;
recognitionRequest.shouldReportPartialResults = YES;
recognitionTask = [speechRecognizer recognitionTaskWithRequest:recognitionRequest resultHandler:^(SFSpeechRecognitionResult * _Nullable result, NSError * _Nullable error) {
BOOL isFinal = NO; …Run Code Online (Sandbox Code Playgroud) 我正在使用<ion-select>下拉列表,它按预期工作,但我在这里想要的是所选选项的索引<ion-select>
我已经使用<ion-select>并更改了事件,如下所示:
<ion-select class="myCustomSelect" [(ngModel)]="selectedProductDD" interface="popover" (ionChange)="onSelectChange($event)">
<ion-option *ngFor="let selectedProduct of productArray" [value] = selectedProduct.pid>{{ selectedProduct.pid }} </ion-option>
</ion-select>
Run Code Online (Sandbox Code Playgroud)
更改事件:
onSelectChange(selectedValue: any) {
//Here I want Index also.
//Currently I am getting selected Value.
}
Run Code Online (Sandbox Code Playgroud)
让我知道是否有人可以帮助我!
提前致谢。
我在PDFView中加载PDF文件但无法从Bundle获取PDF文件URL.
请检查以下代码:
let pdfView = PDFView(frame: self.view.bounds)
let myFileName = "sample"
guard let url = Bundle.main.url(forResource: myFileName, withExtension: "pdf") else {
return
}
pdfView.document = PDFDocument(url: url)
self.view.addSubview(pdfView)
Run Code Online (Sandbox Code Playgroud)
每次我nil进去url.
编辑:
这是我的项目窗口:
我犯了什么傻话吗?
请指导我.
提前致谢.
我正在开发一个项目,在该项目中,我使用了PrimeNg带有 froze & unfroze 列属性的表,并且它在创建普通列时工作正常,*NgFor但是如果我添加新列而不*NgFor在 froze 和 unfroze 表中重复。
如何克服这个问题,因为我希望该列仅在冻结列上而不在未冻结列上。
我的代码:
<ng-template pTemplate="header" let-columns>
<tr>
<th>All</th>
<th *ngFor="let col of columns">
{{col.header}}
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr>
<td>
<p-tableCheckbox
[value]="rowData"
[attr.disabled]="
rowData.setupType === 'No Action' &&
rowData.currentStatus === 'INACTIVE'
? 'disabled'
: null
"
></p-tableCheckbox>
</td>
<td *ngFor="let col of columns">
{{rowData[col.field]}}
</td>
</tr>
</ng-template>
Run Code Online (Sandbox Code Playgroud)
列重复问题:
如何克服这个问题?
如果可能,请在PrimeNg表格中指导我。
ios ×4
objective-c ×4
angular ×2
primeng ×2
admob ×1
cocoa-touch ×1
firebase ×1
ion-select ×1
ionic2 ×1
ios11 ×1
multi-select ×1
swift3 ×1
touches ×1