我正在调查aurioTouch2示例代码.
我注意到,当我们分析音频数据时,我们只使用这个数据的第一个缓冲区,而不使用其他缓冲区.在void FFTBufferManager::GrabAudioData(AudioBufferList *inBL)功能:
UInt32 bytesToCopy = min(inBL->mBuffers[0].mDataByteSize, mAudioBufferSize - mAudioBufferCurrentIndex * sizeof(Float32));
memcpy(mAudioBuffer+mAudioBufferCurrentIndex, inBL->mBuffers[0].mData, bytesToCopy);
Run Code Online (Sandbox Code Playgroud)
在功能上
static OSStatus PerformThru(
void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData)
if (THIS->displayMode == aurioTouchDisplayModeOscilloscopeWaveform)
{
AudioConverterConvertComplexBuffer(THIS->audioConverter, inNumberFrames, ioData, THIS->drawABL);
SInt8 *data_ptr = (SInt8 *)(THIS->drawABL->mBuffers[0].mData);
}
Run Code Online (Sandbox Code Playgroud)
问题是为什么我们忽略inBL-> mBuffers 1 .mData中的数据?
在viewDidLoad我设置:
UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
[swipeGesture setDirection:(UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionRight)];
[self.view addGestureRecognizer:swipeGesture];
-(void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer {
NSLog(@"Swipe received.");
UISwipeGestureRecognizerDirection temp = recognizer.direction;
if (recognizer.direction == UISwipeGestureRecognizerDirectionLeft)
{
[self backCalendarPressed:nil];
}
else if (recognizer.direction == UISwipeGestureRecognizerDirectionRight)
{
[self nextCalendarPressed:nil];
}
}
Run Code Online (Sandbox Code Playgroud)
但recognizer.direction总是等于' 3'.这就是为什么我无法确定它是向左还是向右滑动.
更新
我想更改导航栏中后退按钮中的箭头和文本之间的偏移量。在我设置之前它工作得很好
UINavigationBar.appearance().standardAppearance = newAppearance
这是完整的代码:
let appearance = UINavigationBar.appearance()
let standardAppearance = UINavigationBarAppearance()
standardAppearance.configureWithOpaqueBackground()
standardAppearance.backgroundColor = someColor
standardAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: titleColor]
standardAppearance.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: titleColor]
standardAppearance.shadowColor = navigationShadowColor
// if remove theses 2 line, offset code works!!!
appearance.standardAppearance = standardAppearance
appearance.scrollEdgeAppearance = standardAppearance
// code to set offset
UIBarButtonItem
.appearance()
.setBackButtonTitlePositionAdjustment(
UIOffset(horizontal: -20, vertical: 0),
for: .default)
Run Code Online (Sandbox Code Playgroud) 我需要用Helvetica-Regular创建UIFont,我使用这段代码:
UIFont *font = [UIFont fontWithName:@"Helvetica-Regular" size:size];
Run Code Online (Sandbox Code Playgroud)
但字体是nill.如何正确地做到这一点?
当我想转换NSString为int
我使用时:
[string intValue];
Run Code Online (Sandbox Code Playgroud)
但是如何确定字符串是否int值?例如,以避免这样的情况:
[@"hhhuuukkk" intValue];
Run Code Online (Sandbox Code Playgroud) 我使用此代码在Google Map for iOS上创建标记.
self.mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
self.mapView.myLocationEnabled = YES;
self.mapView.accessibilityElementsHidden = NO;
self.mapView.frame = self.view.bounds;
self.mapView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.mapView.delegate = self;
self.mapView.settings.myLocationButton = YES;
[self.view addSubview:self.mapView];
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.map = self.mapView;
Run Code Online (Sandbox Code Playgroud)
但我需要标记看起来像这样:

我知道如何使用Apple Map,但我需要使用Google Map(因为在某些城市Apple Map几乎没有显示任何内容).
对于谷歌地图,我发现只有这样的代码:
marker.icon = image; // image from xib file
Run Code Online (Sandbox Code Playgroud)
所以我需要为xib为每个标记创建图像.我会有很多标记,所以可能采用这种方法我会得到记忆警告.
有人知道更好的方法来实现这样的标记吗?
在我总是不得不向服务器开发人员提供推送通知证书(p12文件)之前,他可以将推送通知发送到我的应用程序。
根据苹果的说法:
提供者身份验证令牌是您构造的JSON对象,其标头必须包括:用于加密令牌的加密算法(alg)从您的开发人员帐户获得的10个字符的密钥标识符(kid)密钥。令牌必须包括:发行人(ISS)注册权利要求的关键,它的值是您的10个字符的团队ID,从开发者的帐户所发出的获得(IAT)注册的权利要求的关键,其值指示在其中生成该令牌的时候,以自大纪元以来的秒数表示,单位为UTC
问题是从开发者帐户中拿走这些孩子,是,闲置价值?
我正在尝试理解以下代码:
inline SInt32 smul32by16(SInt32 i32, SInt16 i16)
{
register SInt32 r;
asm volatile("smulwb %0, %1, %2" : "=r"(r) : "r"(i32), "r"(i16));
return r;
}
Run Code Online (Sandbox Code Playgroud)
有人知道这个汇编指令做什么吗?
更新: PS我使用目标C。我应该从汇编中了解一些代码。这就是为什么我很难理解这段代码的原因。
对于我的uipickerview,我有:
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
CGSize size = [pickerView rowSizeForComponent:0];
UILabel *labelMain = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
labelMain.backgroundColor = [UIColor clearColor];
labelMain.font = [UIFont fontWithName:kFontSegoeSemiBold size:14];
labelMain.textColor = kColor_default_orangeText;
labelMain.textAlignment = NSTextAlignmentCenter;
int age;
// from
if (pickerView == self.pickerFrom) {
age = minAge + row;
}
// to
else {
age = minAge_pickerTo + row;
}
labelMain.text = [NSString stringWithFormat:@"%d", age];
return labelMain;
}
Run Code Online (Sandbox Code Playgroud)
我知道如何制作蓝色选择指示器(我在uipickerview后面放置蓝色视图,并将标签背景颜色设置为clearColor.
我需要有这个选择器(从/到年龄选择器)(蓝色垂直线只适用于photoshop):

现在我已经创建了这个选择器:

我有一个问题:
我想在选择指示器(或拾取器视图的中心)中的区域具有白色文本颜色,在拾取器视图的其他区域中具有橙色文本颜色.可能吗?
我通过 Crashlytics 将构建发送给我的客户,但他无法安装它(我将他的设备的 UDID 添加到配置文件中)。我认为,问题是因为他没有为开发设置他的设备(因为我的构建是开发的,而不是生产的)。
例如,当我在 iPhone 设置中打开并向下滚动时,我会看到开发人员字符串:
但是我的客户在他的 iPhone 中没有看到这个字符串。他如何启用此菜单项?(他没有应用程序 macbook,所以他无法使用 xCode 启用它)
当应用程序进入后台时,我会收到通知UIApplicationDidEnterBackground。应用程式收到时,我能否收到几乎相同的通知suspended?因此,由于蓝牙,CLLocationManager等原因,该应用程序可以在后台运行,但有时会被挂起。在这种情况下,我需要知道这一点,是否有类似的通知UIApplicationDidEnterBackground?
我必须显示图像的幻灯片.但有一刻我只知道当前和以前的图像(因为内存管理).我需要用动画显示下一个图像(用户可以显示动画类型).但我看不到动画,只是出现没有动画的新图像.这是我的代码:
UIImageView *prevImageView = [self getImageViewWithIndex:currentIndex];
UIImageView *nowImageView = [self getImageViewWithIndex:newIndex];
currentIndex = newIndex;
[UIView animateWithDuration:4 delay:0 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
[slideShowView addSubview:nowImageView];
} completion:^(BOOL finished) {
[prevImageView removeFromSuperview];
}];
Run Code Online (Sandbox Code Playgroud)
我尝试了不同的动画选项.试图将新图像设置为现有图像视图
nowImageView.image = newImage;
Run Code Online (Sandbox Code Playgroud)
但这没有帮助.
以下是我尝试根据Apple WWDC重复但使用自动布局的代码:
extension AugmentedReallityViewController {
@objc func handlePan(recognizer: UIPanGestureRecognizer) {
// // hide languages and units anyway
// moveUnitView(show: false)
// moveLanguageView(show: false)
//
// let isNowExpanded = settingsPanelState == SettingsPanelState.expanded
// let newState = isNowExpanded ? SettingsPanelState.collapsed : SettingsPanelState.expanded
//
// switch recognizer.state {
// case .began:
// startInteractiveTransition(state: newState, duration: 1)
// isLastPanelUpdateToReachTheNewState = true // just in case, but we should change this property later
// case .changed:
// let translation = recognizer.translation(in: viewSettings)
// let fractionComplete …Run Code Online (Sandbox Code Playgroud) ios ×12
iphone ×8
objective-c ×4
ipad ×2
swift ×2
arm ×1
assembly ×1
audio ×1
c ×1
crashlytics ×1
fft ×1
frequency ×1
gmsmapview ×1
google-maps ×1
nsstring ×1
uiappearance ×1
uifont ×1
uiimageview ×1
uipickerview ×1
uiview ×1
xcode ×1