weibo project note

1. How to hide system built tabbar and add custom tabbar in a tabbarController?

Set self.tabBar.hidden = YES; in init() method to hide the system built tabbar. Create a UIView as the custom tabbar and add it to the tabbarController's view.


2. What should be borne in mind when using DDMenu?

DDMenu's view is (0,20,320,460). So you will have to minus 20 pixel at the top of the custom tabbar.


3. How to access sina weibo sdk?

http://open.weibo.com/apps


4. What should be borne in mind when using [UIImage imageNamed] and [UIImage imageWithContentsOfFile] ?

[UIImage imageNamed] find image under the direct project path. and will treat "xxx" as "xxx.png".

[UIImage imageWithContentsOfFile] find image with the given file path. and the extender of png files is required.


5. What should be borne in mind when using NSNotification?

The notification observer need to be removed in dealloc method.

[[NSNotificationCenter defaultCenter] removeObserver:self name:kNotification object:nil];


6. What is the difference between 4.x and 5.0 above in terms of customizing navigationbar background?

For 5.0 above, we can call [self.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault]; to customize navigationbar.

For 4.x, we can create a category and implement the drawRect method. There is no need to include this category in the code anywhere. The compiler will tackle it.


7. How to change the theme for navigationbar?

We can send a notification for custom theme controllers. After receiving the notification,

1) For 5.0 above, we can call setBackgroundImage method.

2) For 4.x, as we render the image in navigationbar's drawRect method. We need to call setNeedsDisplay method to let the rendering engine call drawRect asynchronously.


8. What if you encounter "unrecognized selector sent to instance"?

The problem is caused when a released object attempts to call a method, especially when we forgot to retain the object during init. Use self.property to automatically retain the object.


9. What library should be imported in order to use RegexKitLite?

libicucore.dylib


10. What should be borne in mind when performing string replacing using RegexKitLite?

Note the difference between stringByReplacingOccurrencesOfRegex and stringByReplacingOccurrencesOfString.

the former is used to replace the string which matches the regex pattern.

the latter however replace the string itself.


11. What opensource or tool libraries are used in the project?

a) UIViewExt, an extension for UIView for the sake of convenience.

b) NSString+URLEncoding, to encode and decode the UTF-8 characters.

c) RegexKitLite, a tool for handling regular expression.

d) DDMenu, a tool with left, main and right views.

e) RTLabel, a replacement for UILabel with the support of html links.

f) SDWebImage, a tool for retrieving images from the remote network with cache mechanism.

g) CustomCategory, an objective-c extension of UINavigationBar to render the background image under ios5.

h) WXBaseModel, several methods implemented in this class are necessary for a light-weight json object ORM.

i) EgoTableViewPullRefresh, a tool that enabling pull down and pull up refreshing.

j) MBProgressHUD, a loading indicator.

k) Reachability, a tool to check the network connection type and reachability.


12. How many measures are there to create a tableViewFooter?

2 measures.

M1: self.tableViewFooter = _moreButton;

M2: implementing the viewForFooterInSection and heightForFooterInSection

The difference between M1 and M2 is that M1 only displays the footer view at the bottom of the tableView while M2 displays it always at the bottom of the tableView in current screen.


13. Keep an eye on HTML5

phonegap, jquerymobile, senchatouch etc


14. How to reference a xib to a controller?

You should specify the class(controller) name in the "File's Owner". Draw a line between the components in xib and "File's Owner". Be sure to link the delegates and the view as well. You may need to right click the top-level view and draw a line between the "Referencing Outlets" and "File's Owner".


15. How to get the viewController in a deep-level sub UIView?

Sometimes you want the high-level UIView or ViewController to respond to an event trigger by a deep-level sub UIView. The problem is that the high-level vc does not own a reference of the subview and the delegate mechanism is awkward because you'll have to populate several delegates until the high-level vc can reach it. So is the block mechanism. Admittedly the notification will work but it is 1 to N, meaning you may have to handle the notification event in several places.

So the preferable approach is to get the vc where the subview is managed. The idea is to traverse the class type of the next UIResponder until it is a UIViewController. It is important to understand the responder chain.


16. How to add click event on UIView or UIImageView?

Firstly, set the userInterfaceEnabled=YES, and then add a UITapGestureRecognizer to it. The event could be stored in a block.

There is also a tricky way to do that, by adding a transparent UIButton with the exactly same frame with the view and add the touchUpInside action on the button.


17. What should be bourne in mind when using a Custom UIView widget in an interface builder?

You may have set the specific class type in the interface builder but find the widget won't work as you expected. You wrote something in the init method of the widget and that is the problem, because the init method will never be called if it is created in an interface builder.  So what should we do? Simply put the code piece into the awakeFromNib method but be sure the relevant operation is called only once by doing a nil check.


18. Should we release everything created in a block, and is it OK to reference a object when it is still nil at the moment the block is initialized?

the references which the block owns will all be release when the block itself is released. So if the block is a property and be properly released in dealloc method, no extra release operation is needed for objects referenced by it. And also it is important to know that the block is a callback function which will only be executed when it is called. Therefore, it does not matter if objects in the block are nil when the block is defined.


19. When presenting a modal viewController by clicking the button in the rightViewController of DDMenu, how to return to the mainViewController after the dismissal?

Call the showRootController method in the viewDidAppear method in the DDMenuController.


20. How to get the streched UIImageView from a given one?

[image stretchableImageWithLeftCapWidth:<leftCapWidth> topCapHeight:<topCapHeight>];  Note that the leftCapWidth and the topCapHeight is the x and y distance from the original point where the stretching begins.


21. What if a NSString is a NSNull?

first, specify the NSString as id, and then judge "string == [NSNull null]"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值