Although there is only one line in the if-block, it's error-prone to miss the brackets. Please adding the brackets:
      if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) { //for ios7, to adjust layout
            self.edgesForExtendedLayout = UIRectEdgeNone;
      }