我有一个仅限肖像模式的应用程序,但是当用户播放视频时,我希望它以全屏横向模式播放(视频播放器在纵向模式下看起来不太好).我这样玩:
[self.view addSubview:myMoviePlayer.view];
[self.myMoviePlayer setFullscreen:YES animated:YES];
[self.myMoviePlayer play];
Run Code Online (Sandbox Code Playgroud)
实现这一目标的最佳方法是什么?
是否有可能以这种方式制作一个uibutton,使得背景中出现的东西或其他东西,例如麦穗来自田地.
这可能吗?
谢谢 :)
是否有可能得到一个反射获得的类型的"c#名称",如:
System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
Run Code Online (Sandbox Code Playgroud)
我想得到:
List<String>
Run Code Online (Sandbox Code Playgroud)
没有拆分字符串有可能吗?例如,使用Reflection.
谢谢!
我试图像我这样覆盖我的cellForRowAtIndexPath方法中的方法
cell.customSwitch {
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
{
[super touchesEnded:touches withEvent:event];
NSLog(@"customSwitch touchesended");
}
};
Run Code Online (Sandbox Code Playgroud)
但这不起作用(我通常是一个Java人:P).任何帮助将非常感激!
如何添加计时器来检测在 iPhone 上按下 UIButton 的时间?
谢谢
我想保存swtich状态并在程序重启时加载它.
[[NSUserDefaults standardUserDefaults] setBool:switchControl.on forKey:@"switch"];
[[NSUserDefaults standardUserDefaults] synchronize];
Run Code Online (Sandbox Code Playgroud)
这是保存部分
BOOL test= [[NSUserDefaults standardUserDefaults] boolForKey:@"switch"];
NSLog(@"%@",test?@"YES":@"NO");
if(test == YES)
[switchControl setOn:YES animated:YES];
else
[switchControl setOn:NO animated:YES];
Run Code Online (Sandbox Code Playgroud)
这是需要将切换设置为其值的部分.我在viewdidload方法中执行了此操作,因为当我关闭应用程序并重新启动它时,我希望交换机的状态设置保存的部分.
但它仍然显示默认部分可以帮我设置它吗?
HI,如何在uitableview中一次实现一个checkmark,然后如何在我的应用程序中保存该状态?请指导.现在我有一个表,表行中的数据来自nsmutablearray.My .m文件如下:
#import "LocationSelection.h"
@implementation LocationSelection
@synthesize menuList, table;
- (void)viewDidLoad {
menuList=[[NSMutableArray alloc] initWithObjects:
[NSArray arrayWithObjects:@"LOCATION1",nil],
[NSArray arrayWithObjects:@"LOCATION2",nil],
[NSArray arrayWithObjects:@"LOCATION3",nil],
[NSArray arrayWithObjects:@"LOCATION4",nil],
[NSArray arrayWithObjects:@"LOCATION5",nil],
[NSArray arrayWithObjects:@"LOCATION6",nil],
[NSArray arrayWithObjects:@"LOCATION7",nil],
nil];
[self.navigationController setNavigationBarHidden:NO];
self.navigationController.navigationBar.tintColor=[UIColor blackColor];
self.navigationController.navigationBar.barStyle=UIBarStyleBlackTranslucent;
self.title=@"Location Selection";
[table reloadData];
[super viewDidLoad];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)theTableView{
return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 40;
}
- (NSInteger)tableView:(UITableView *)theTableView numberOfRowsInSection:(NSInteger)section{
return menuList.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [table dequeueReusableCellWithIdentifier:CellIdentifier]; …Run Code Online (Sandbox Code Playgroud) 我有一个NSMutableArray的问题...在我的函数中填充NSMutableArray(readRoutes)后我无法提取对象....在readRoutes函数内我可以...我无法想象问题在哪里..
首先,NSMutableArray在readRoutes方法中填充Route对象...(在RoutesListView内部文件中)(我需要用这些Route对象填充TableView单元格...)
这是Route.h文件:
@interface Route : NSObject {
NSString *routeId;
NSString *routeDirection;
NSString *routeName;
NSString *routeCode;
}
@property (nonatomic,retain) NSString *routeId;
@property (nonatomic,retain) NSString *routeDirection;
@property (nonatomic,retain) NSString *routeName;
@property (nonatomic,retain) NSString *routeCode;
-(id)initWithName:(NSString *)name direction:(NSString *)d routeId:(NSString *)rid code:(NSString *)c;
@end
Run Code Online (Sandbox Code Playgroud)
Route.m文件:
#import "Route.h"
@implementation Route
@synthesize routeId;
@synthesize routeDirection;
@synthesize routeName;
@synthesize routeCode;
-(id)initWithName:(NSString *)name direction:(NSString *)d routeId:(NSString *)rid code:(NSString *)c{
self.routeId=rid;
self.routeName=name;
self.routeDirection=d;
self.routeCode=c;
return self;
}
@end
Run Code Online (Sandbox Code Playgroud)
现在这是RoutesListView.h文件(UITableViewController)
#import <UIKit/UIKit.h>
#import "Route.h"
@interface RoutesListView : UITableViewController …Run Code Online (Sandbox Code Playgroud)