这是一个非常奇怪的过程.
我有一个UIButtons的IBOutletCollection.我遍历集合并像这样创建它们(displayHourButtons从中调用viewWillAppear):
- (void)displayHourButtons
{
// Counter
NSUInteger b = 0;
// Set attributes
UIFont *btnFont = [UIFont fontWithName:@"Metric-Semibold" size:13.0];
UIColor *btnTextColor = [UIColor colorWithRed:(147/255.0f) green:(147/255.0f) blue:(147/255.0f) alpha:1.0];
NSNumber *btnTracking = [NSNumber numberWithFloat:0.25];
NSMutableParagraphStyle *btnStyle = [[NSMutableParagraphStyle alloc] init];
[btnStyle setLineSpacing:2.0];
NSDictionary *btnAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
btnFont, NSFontAttributeName,
btnTextColor, NSForegroundColorAttributeName,
btnTracking, NSKernAttributeName, nil];
// CREATE THE BUTTONS
for (UIButton *hourButton in hourButtons) {
// I'm using the attributed string for something else
// later in development …Run Code Online (Sandbox Code Playgroud) 我偶尔会看到我的UITableView的一部分,其中没有包含该部分的单元格.在那种情况下,由于上部没有单元格,因此有两个标题在彼此的顶部.我试图找出如何暂时隐藏上面的标题然后在我稍后回到页面时重新出现.
我可以返回零-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section,然后强制它在viewWillAppear中再次调用吗?
另外,如果我使用重新加载数据[self.tableView reloadData],你如何只返回UITableView标题的标准高度?
为什么在最新版本的Xcode(dp-4)中声明retain,nonatomic的变量是在变量名称之前使用下划线?这是否会产生某种类型的安全性?
例如,我创建了一个属性:
@property (retain, nonatomic) IBOutlet UILabel *name;
Run Code Online (Sandbox Code Playgroud)
除非我改变里面的变量dealloc而没有_,否则我必须这样做:
@synthesize name = _name;
Run Code Online (Sandbox Code Playgroud)
为什么是这样?
我需要看到HomeScreen从UIWindow通过使UIWindow背景为透明.怎么做到这一点?
我试过[UIColor ClearColor];但它只显示BlackColor.
我是一个业余的ios开发人员,版本4.6的xcode和OSX 10.8.4.我正在尝试制作一个播放声音的应用程序但是当我尝试运行该应用程序时,我收到此消息:
*由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'* - [NSURL initFileURLWithPath:]:nil string parameter'
我的应用程序也不会启动.
这是我的视图controller.h的代码:
ViewController.h:
#import <UIKit/UIKit.h>
#import <RevMobAds/RevMobAds.h>
#import <AVFoundation/AVFoundation.h>
@interface ViewController : UIViewController
- (IBAction)playButton:(id)sender;
- (IBAction)stopButton:(id)sender;
@end
Run Code Online (Sandbox Code Playgroud)
这是我的视图controller.m:
Viewcontroller.m:
#import "ViewController.h"
#import <RevMobAds/RevMobAds.h>
@interface ViewController ()
{
AVAudioPlayer *avPlayer;
}
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *stringPath = [[NSBundle mainBundle]pathForResource:@"98648__dobroide__20100606-mosquito" ofType:@"mp3"];
NSURL *url = [NSURL fileURLWithPath:stringPath];
NSError *error;
avPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:url error:&error];
[avPlayer setNumberOfLoops:-1]; …Run Code Online (Sandbox Code Playgroud) ios ×4
objective-c ×4
iphone ×2
header ×1
ipad ×1
macos ×1
uibutton ×1
uitableview ×1
xcode ×1