您好我想将默认的UISegmentControl字体更改为自定义字体,并将选定的段颜色更改为另一种颜色而不是更暗的颜色.
谢谢
由此

对此

编辑:方案 称为
//更改字体大小,删除阴影,所选文本和背景颜色与正常状态不同
-(void)defineSegmentControlStyle
{
//normal segment
NSDictionary *normalAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"Rok" size:20.0],UITextAttributeFont,
[UIColor colorWithRed:75.0/255.0 green:75.0/255.0 blue:75.0/255.0 alpha:1.0], UITextAttributeTextColor,
[UIColor clearColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
nil];//[NSDictionary dictionaryWithObject: [UIColor redColor]forKey:UITextAttributeTextColor];
[infoSegment setTitleTextAttributes:normalAttributes forState:UIControlStateNormal];
NSDictionary *selectedAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"Rok" size:20.0],UITextAttributeFont,
[UIColor whiteColor], UITextAttributeTextColor,
[UIColor clearColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
nil] ;//[NSDictionary dictionaryWithObject: [UIColor redColor]forKey:UITextAttributeTextColor];
[infoSegment setTitleTextAttributes:selectedAttributes forState:UIControlStateSelected];
}
Run Code Online (Sandbox Code Playgroud) 我想测量周围的音量,不太确定我做的是否正确.
我想创建一个范围为0(安静)到120(非常嘈杂)的VU表.
我获得了峰值和平均功率,但在正常安静的环境中非常高.请给我一些指针.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//creating an audio CAF file in the temporary directory, this isn’t ideal but it’s the only way to get this class functioning (the temporary directory is erased once the app quits). Here we also specifying a sample rate of 44.1kHz (which is capable of representing 22 kHz of sound frequencies according to the Nyquist theorem), and 1 channel (we …Run Code Online (Sandbox Code Playgroud) 我需要一些帮助.我想通过Bump将Jpg或PNG图像从一个iPhone转移到另一个iPhone.我遇到了成功和失败,根本没有发送图像.
下面是一个NSObject文件,当用户从UIimagepicker中选择图像时将调用该文件.
接收方不会发送任何数据,只会接收.
请帮我看看代码并给我任何评论或观点.
谢谢,感谢您的帮助.
- (id) init{
if(self = [super init]){
bumpObject = [BumpAPI sharedInstance];
NSError *error;
NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"sound_bump_tap" ofType:@"aif"]];
bumpsound = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:&error];
[bumpsound prepareToPlay];
}
return self;
}
-(void) configBump
{
[bumpObject configAPIKey:@"My API Key"]; //put your api key here. Get an api key from http://bu.mp
[bumpObject configDelegate:self];
[bumpObject configParentView:self.bumpShare.view];
[bumpObject configActionMessage:@"Bump with your friend to start."];
}
- (void) startBump{
[self configBump];
[bumpObject requestSession];
}
- (void) stopBump{
[bumpObject endSession]; …Run Code Online (Sandbox Code Playgroud) 一旦你点击搜索栏,任何人都知道如何调整暗淡的黑色大小?
我点击时有问题取消了tableview将消耗然后动画消失.
我用它来调整我的结果tableview.
-(void)searchDisplayController:(UISearchDisplayController *)controller didShowSearchResultsTableView:(UITableView *)tableView {
tableView.frame =fTableView.frame;//CGRectMake(26, 100, 280, 310); //fTableView.frame;
tableView.backgroundColor = [UIColor colorWithRed:243.0/255.0 green:236.0/255.0 blue:212.0/255.0 alpha:1];
}
Run Code Online (Sandbox Code Playgroud)
单击搜索栏时,灰色叠加层已满,而不是我定义的大小.


单击取消按钮时,视图将重新开始.

我正在运行我的应用程序正常运行,直到我从后台恢复或没有位置服务,应用程序将崩溃.
崩溃日志显示异常类型:EXC_CRASH(SIGTRAP)
有谁知道如何调试它?
Exception Type: EXC_CRASH (SIGTRAP)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x36398848 __kill + 8
1 FrogFinder 0x000b5034 0x69000 + 311348
2 CoreFoundation 0x3447e980 __handleUncaughtException + 68
3 libobjc.A.dylib 0x346ce2ca _objc_terminate + 122
4 libc++abi.dylib 0x338a33be _ZL19safe_handler_callerPFvvE + 70
5 libc++abi.dylib 0x338a344a std::terminate() + 14
6 libc++abi.dylib 0x338a481e __cxa_rethrow + 82
7 libobjc.A.dylib 0x346ce22e objc_exception_rethrow + 6
8 CoreFoundation 0x343d453e CFRunLoopRunSpecific + 398
9 CoreFoundation 0x343d439e …Run Code Online (Sandbox Code Playgroud) 不知何故,我知道为什么默认动画失败.
我的搜索栏没有按照预期的那样向上移动.
视图在UIView中,我想知道这是不是问题.
包括IB布局

我需要一些帮助,我需要知道如何创建从数组中检索的字符串数组.我正在使用powerplot图表,它只接受浮点数或字符串数组.
我需要动态地创建这样的东西.
的NSString*sourceData [7] = {@ "2",@ "1",@ "4",@ "8",@ "14",@ "15",@ "10"};
下面是我的代码,以找出字符串中的数字.
NSInteger drunked = [appDelegate.drinksOnDayArray count];
NSMutableArray * dayArray = [[NSMutableArray alloc] init];
NSMutableArray * sdArray = [[NSMutableArray alloc] init];
//float *sdArray[7];
for (int i=0; i<drunked; i++) {
DayOfDrinks *drinksOnDay = [appDelegate.drinksOnDayArray objectAtIndex:i];
NSString * dayString= [NSDate stringForDisplayFromDateForChart:drinksOnDay.dateConsumed];
[dayArray addObject:dayString];
NSLog(@"%@",[dayArray objectAtIndex:i]);
drinksOnDay.isDetailViewHydrated = NO;
[drinksOnDay hydrateDetailViewData];
NSString * sdString= [NSString stringWithFormat:@"%@", drinksOnDay.standardDrinks];
[sdArray addObject:sdString];
NSString *tempstring;
NSLog(@"%@",[sdArray objectAtIndex:i]);
}
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助 :)
我想知道这个应用程序是如何在UIKit中叠加uiimage和摇摆不定的.
我正在关注这个xcode:使用带有NSTimers的UIImageView子类 使图像随机下降,但是如何捕获它并将UIImage堆叠在一起?

谢谢你的回复...编辑:为了清楚
https://www.youtube.com/watch?v=2dpZCoi4xFk 40秒后将展示它如何叠加在一起并与加速度计一起摆动
这将模拟UIIimageView的删除
- (void)viewDidLoad {
[super viewDidLoad];
// set the background color to something COLD
self.view.backgroundColor = [UIColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:1.0];
// load our ph image we will use the same image over and over
phImage = [UIImage imageNamed:@"placeholder.png"];
// start a timet that will fire 1 times per second
[NSTimer scheduledTimerWithTimeInterval:(1) target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
}
// Timer event is called whenever the timer fires
- (void)onTimer
{
// build a …Run Code Online (Sandbox Code Playgroud) 这可能在某处得到回答,但我似乎无法找到答案。
我有各种进口
import KeychainAccess
import Alamofire
import SwiftyJSON
import ...
import ...
import ...
Run Code Online (Sandbox Code Playgroud)
我真的可以将它们全部添加到一个 swift 文件中import HeaderHelper吗?我试图像 ObjC 一样导入但得到了No such module 'HeaderHelper'
任何一点将不胜感激。
干杯