I'm applying for a WWDC scholarship and I need to get my app into 2 file formats. 1 is the Xcode project and the other is a .app or .ipa file. I don't know what to do to get either of these. Can anybody please tell me how this is done?
dimanche 26 avril 2015
How to load HTML in UITextView?
I have a HTML contents with achor tag in it. I just want to load that HTML content in UITextView.
samedi 25 avril 2015
How to AutoLayout the buttons in uiview controller in iphone?
I have size of 4 inch and i have added 4 icons in 3 different rows of all equal size 60x60. I can have a proper view in iphone 4s,5,5s but not in iphone 6 and 6 plus. So how can i apply auto layout to it and make the icons look bigger and of same ratio in iphone 6 and 6 plus. Can this be made without any coding?
Xcode 6.3 (and 6.2) hits breakpoint on [UIFont fontWithName: size:]
In My iOS Application im using a class (DKTheme) to keep my fonts and images in a centralised place. my implementation looks like this.
+ (instancetype)theme {
static DKTheme *_theme = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_theme = [[DKTheme alloc] init];
});
return _theme;
}
- (id)init {
self = [super init];
if (self) {
[self setupTheme];
}
return self;
}
- (void)setupTheme {
// some code here
self.smallButtonFont = [UIFont fontWithName:@"Helvetica-Bold" size:13.0f];
//some code here
}
And when i run this code in device (iPhone 5C, iOS8.3 and iOS8.2), xcode hits breakpoint on the line self.smallButtonFont = [UIFont fontWithName:@"Helvetica-Bold" size:13.0f]; if i click continue execution button, application continue running without crashing and my font property(self.smallButtonFont) is successfully initialised.
and i noticed one more thing, i have several [UIFont fontWithName: size:]; calls and breakpoint hits only first time call.(if i comment the first one then next method call hits the break point). it is really annoying this breakpoint issue, any help would be thankful.
dismissViewControllerAnimated not being called on iPhone
I have the following code where I am trying to show a PDF preview. It words perfectly on an iPad however when I am trying to do it on a iPhone it dosnt work.
QLPreviewController* preview = [[QLPreviewController alloc] init];
preview.dataSource = self;
[self dismissViewControllerAnimated:YES completion:^{
[self presentViewController:preview animated:YES completion:nil];
}];
The thread on the iPhone never makes it to this line
[self presentViewController:preview animated:YES completion:nil];
but works fine on ipad.. I am not sure what to even look at. Any help would be appreaciated.
Getting app freeze and cell becomes empty when prepareForReuse used
I have tried prepareforreuse but now my app getting stuck while scrolling and cell is empty. Is there any wrong I'm doing? please help. All my subviews are added in XIB.
static NSString *cellIdentifier1 = @"pollCell";
IXPollCustomCell *pollCell = (IXPollCustomCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier1];
if (pollCell == nil) {
pollCell = [[[NSBundle mainBundle] loadNibNamed:@"IXPollCustomCell" owner:self options:nil] objectAtIndex:0];
pollCell.selectionStyle = UITableViewCellSelectionStyleNone;
IXPollCustomCell.m
- (void)prepareForReuse
{
[[self.contentView viewWithTag:2001] removeFromSuperview]; //Does not crash if the view is nil. It's okay to send messages to nil in ObjC
}
IXPollCustomCell.h
@property (weak, nonatomic) IBOutlet UIView *multiChoiceView;
@property (weak, nonatomic) IBOutlet UIView *multiOption1View;
@property (weak, nonatomic) IBOutlet UILabel *choice1RateLabel;
@property (weak, nonatomic) IBOutlet UILabel *color1Label;
@property (weak, nonatomic) IBOutlet UIButton *option1Button;
iOS Auto Layout UIView Drawing cycle
In one of the WWDC videos, Apple said that the layout is done from top down, ie from superview to subview (after constraints are calculated from bottom up). Display is also done from top down.
My questions are: 1. At what point in the viewcontroller is a view's frame (origin and size) determined? I tried to log the size of a view (defined using auto layout), but it was always 0 0 0 0, which is odd, because the view is already generated in the simulator;
For an autoresized view, when is view.frame available?
- Same question, except this time it is UIImageView.frame. I tried to log to console, even though the size is fit into the constraints, the logged UIImageView frame is 0 0 width_of_original_image height_of_original_image. But for other views like labels, the frame is printed correctly on the console.
It seems like that there is a mysterious auto layout engine that performs transform, and nobody knows what is going on inside the engine, but to check what is thrown onto the simulator display to figure out how the view was rendered by this engine???